Article View: comp.mail.mush
Article #521Re: Problem setting headers to output from shell commands
From: Barton E. Schaefer
Date: Sat, 22 Sep 1990 15:26
Date: Sat, 22 Sep 1990 15:26
28 lines
1264 bytes
1264 bytes
In article <142877@sun.Eng.Sun.COM> rock@warp.Eng.Sun.COM (Bill Petro) writes:
}
} Here it is:
}
} #!/bin/sh
} # bq for mush
} #
} if [ $# -lt 2 ]
} then
} echo bq: too few arguments
} echo 'usage: bq variable command [args ...]'
} fi 1>&2
} out=$HOME/.mushbq
} var=$1
} shift
} val=`eval "$@" | tr "\012'" ' "'`
} echo set $var = "'$val'" > $out
Thanks, Bill, but you forgot what needs to go in .mushrc to support this:
cmd bq 'sh bq \!* ; source ~/.mushbq'
The script creates a "set" command and puts it in a specific file from
which mush can "source" it. The "tr" does a little processing to remove
single quotes from the output of the command, so that wrapping the output
in single quotes in the "set" command is certain to work.
--
Bart Schaefer schaefer@cse.ogi.edu
Technical Details
Message-ID:
<12342@ogicse.ogi.edu>Path:
arc1-ca.pugleaf.net!utzoo!attcan!uunet!ogicse!schaeferReferences:
<1990Sep21.091000.11589@ibmpcug.co.uk> <12320@ogicse.ogi.edu> <142877@sun.Eng.Sun.COM>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!ogicse!schaefer From: schaefer@ogicse.ogi.edu (Barton E. Schaefer) Newsgroups: comp.mail.mush Subject: Re: Problem setting headers to output from shell commands Message-ID: <12342@ogicse.ogi.edu> Date: 22 Sep 90 15:26:54 GMT References: <1990Sep21.091000.11589@ibmpcug.co.uk> <12320@ogicse.ogi.edu> <142877@sun.Eng.Sun.COM> Organization: Oregon Graduate Institute (formerly OGC), Beaverton, OR Lines: 28