Re: [Fish-users] How to use functions with --on-signal properly?
Status: Beta
Brought to you by:
liljencrantz
|
From: Glenn J. <ja...@py...> - 2020-07-24 21:40:17
|
No, the `expect` command is watching the spawned process (stdout and
stderr), and it blocks until it sees the text Password appear. Then the
`send` command sends the password to the spawned process (stdin).
On Fri, Jul 24, 2020 at 3:40 PM Tassilo Horn <ts...@gn...> wrote:
> Glenn Jackman <ja...@py...> 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
> Fis...@li...
> https://lists.sourceforge.net/lists/listinfo/fish-users
>
--
*Glenn Jackman*
Senior Software Developer
*Pythian - Love your data*
ja...@py...
Tel: +1 613 565 8696 Ext. 1478
Mobile: +1 613 808 4984
www.pythian.com
--
--
|