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 <t...@gnu.org> wrote:

> 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
>


-- 
*Glenn Jackman*
Senior Software Developer

*Pythian - Love your data*
jack...@pythian.com
Tel: +1 613 565 8696 Ext. 1478
Mobile: +1 613 808 4984
www.pythian.com

-- 


--





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

Reply via email to