Glenn Jackman <jack...@pythian.com> writes:

Hi Glenn,

> This is a good use case for Expect, I think. Something like

Oh, I didn't know it so far but the below looks promising.

> ```tcl
> #!/usr/bin/env expect
>
> spawn openvpn ...
> expect Password
> send -- "$password\r"

Does

  expect Foo

prompt for Foo and automatically bind what was typed to a variable $foo?

> # any other prompts before the connection is made...
>
> interact {
>   \x003 {
>     # user hit Ctrl+C
>     foreach mount {/mnt/a /mnt/b /mnt/c} {
>       puts "unmounting $mount"
>       exec umount $mount
>     }
>     send \x003   ;# send the Ctrl+C to openvpn
>   }
> }
> puts "bye"
> ```

Thanks,
Tassilo



_______________________________________________
Fish-users mailing list
Fish-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/fish-users

Reply via email to