Skip to content

Instantly share code, notes, and snippets.

@bancek
Created October 3, 2012 13:56
Show Gist options
  • Save bancek/3827043 to your computer and use it in GitHub Desktop.
Save bancek/3827043 to your computer and use it in GitHub Desktop.
Bash init buffer. Usage: bashinit "cd some/path\rdosomething\r"
#!/usr/bin/expect
trap {
set rows [stty rows]
set cols [stty columns]
stty rows $rows columns $cols < $spawn_out(slave,name)
} WINCH
spawn "/bin/bash"
set args [split [lindex $argv 0] ";"]
foreach element [lrange $args 0 end-1] {
set celement [string trim $element]
send -- "$celement\r"
}
set last [string trim [lindex $args end]]
send $last
interact
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment