1 # vi:set sts=2 sw=2 ai:
3 # coshell.bash - Control shell coprocesses (see coprocess.bash).
8 while (( $# > 0 )) ; do
18 # This should eat any ssh error messages or what not.
19 coshell
eval : >/dev
/null
2>&1
38 if (( $# == 0 )) ; then
39 echo "coshell eval: no argumentsl" >&2
42 if [ x
$coprocess_pid = x
] ; then
43 echo "coshell eval: no active coshell" >&2
48 coprocess print
"coprocess_rc=\$?"
49 coprocess print
"printf 'coprocess-$cookie----\n%d\n' \$coprocess_rc"
50 if [ x
$coprocess_pid = x
] ; then
55 while coprocess
read ol
; do
57 *coprocess-
$cookie----*)
58 ol
="${ol%coprocess-$cookie----}"
72 s|se|sen|send|sendf|sendfi|sendfil|sendfile
)
74 if (( $# != 2 )) ; then
75 echo "coshell sendfile: syntax is 'coshell sendfile SRC TARGET'" >&2
78 if [ x
$coprocess_pid = x
] ; then
79 echo "coshell sendfile: no active coshell" >&2
84 if coshell
test -d "$target" ; then
85 target
="$target/${1##*/}"
88 coprocess print
"uudecode <<END_OF_FILE"
89 uuencode -m "$target" <$1 |coprocess print --stdin
90 coshell eval "END_OF_FILE
"
97 g|ge|get|getf|getfi|getfil|getfile)
99 if (( $# != 2 )) ; then
100 echo "coshell getfile
: syntax is
'coshell getfile SRC TARGET'" >&2
103 if [ x$coprocess_pid = x ] ; then
104 echo "coshell getfile
: no active coshell
" >&2
109 if test -d "$target" ; then
110 target="$target/${1##*/}"
113 coshell eval uuencode -m "$target" "<" "$1" |uudecode