From 772f20abb0a3a0979c440114bf3a1cff5b3cef03 Mon Sep 17 00:00:00 2001 From: cvpcs Date: Wed, 2 Jun 2010 11:02:31 -0500 Subject: initial import of bash 4.1 --- examples/functions/coshell.README | 53 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 examples/functions/coshell.README (limited to 'examples/functions/coshell.README') diff --git a/examples/functions/coshell.README b/examples/functions/coshell.README new file mode 100644 index 0000000..9675cda --- /dev/null +++ b/examples/functions/coshell.README @@ -0,0 +1,53 @@ +Date: Fri, 21 Sep 2001 14:50:29 -0400 +From: "Jason M. Felice" +To: bash-maintainers@gnu.org, chet@po.cwru.edu +Subject: Bash co-processes functions +Message-ID: <20010921145029.A6093@argo.eraserhead.net> +Mime-Version: 1.0 + +Attached to this message you will find coprocess.bash and coshell.bash. +Here's a brief synopsis of use: + +coprocess open telnet localhost +while coprocess read il ; do + echo "$il" + case "$il" in + *ogin:*) + coprocess print 'user' + ;; + *ord:*) + echo 'pass' |coprocess print --stdin + ;; + *$ *) + coprocess print 'exit' + break + ;; + esac +done +coprocess close + +And here's an example of the coshell function: + +coshell open ssh -l root otherbox +coshell eval hostname +coshell ls -l +if coshell test -d /tmp ; then echo 'otherbox has a /tmp!' ; fi + +coshell sendfile /var/lib/upgrade.rpm /tmp/test.rpm || exit $? +coshell eval rpm -ivh /tmp/test.rpm || exit $? +coshell eval rm -f /tmp/test.rpm || exit $? +coshell close +exit 0 + +There are a few minor issues that I'd like to work out, but it works well +enough for me ;-) The issues are: + +- Shell quoting issue with 'coshell eval' commands - need to somehow + re-quote words. +- Interactive commands hang 'coshell eval', tried redirecting in