1 Date: Fri, 21 Sep 2001 14:50:29 -0400
2 From: "Jason M. Felice" <jfelice@cronosys.com>
3 To: bash-maintainers@gnu.org, chet@po.cwru.edu
4 Subject: Bash co-processes functions
5 Message-ID: <20010921145029.A6093@argo.eraserhead.net>
8 Attached to this message you will find coprocess.bash and coshell.bash.
9 Here's a brief synopsis of use:
11 coprocess open telnet localhost
12 while coprocess read il ; do
16 coprocess print 'user'
19 echo 'pass' |coprocess print --stdin
22 coprocess print 'exit'
29 And here's an example of the coshell function:
31 coshell open ssh -l root otherbox
34 if coshell test -d /tmp ; then echo 'otherbox has a /tmp!' ; fi
36 coshell sendfile /var/lib/upgrade.rpm /tmp/test.rpm || exit $?
37 coshell eval rpm -ivh /tmp/test.rpm || exit $?
38 coshell eval rm -f /tmp/test.rpm || exit $?
42 There are a few minor issues that I'd like to work out, but it works well
43 enough for me ;-) The issues are:
45 - Shell quoting issue with 'coshell eval' commands - need to somehow
47 - Interactive commands hang 'coshell eval', tried redirecting in </dev/null
48 to executed command, but it caused strange shell exit problems.
49 - Some way to copy stdin from local coshell eval to remote shell. Probably
50 logically impossible, but would be wonderfully useful.
52 I'm using it for writing scripts to publish websites and other scripts to