Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/5/84; site danews.UUCP Path: utzoo!watmath!clyde!cbosgd!danews!lvc From: lvc@danews.UUCP (Larry Cipriani) Newsgroups: net.unix,net.unix-wizards Subject: Non-Gripes about /bin/sh Message-ID: <133@danews.UUCP> Date: Mon, 9-Jun-86 16:17:00 EDT Article-I.D.: danews.133 Posted: Mon Jun 9 16:17:00 1986 Date-Received: Thu, 12-Jun-86 01:39:00 EDT References: <931@uwvax.UUCP> Organization: AT&T Bell Labs, Columbus OH Lines: 52 Xref: watmath net.unix:8084 net.unix-wizards:18334 I think you'll find that the shell is far more powerful than the manual page would lead one to believe. I've been using it for 4 years and I'm still learning things about it. I don't know about csh, as I've never used it. The sh manual page describes how to do what you described with multiple files in the Input/Output section. Here are some examples to make it more concrete. exec 3>&1 # make file descriptor 3 a duplicate of stdout exec >${filen} # stdout now goes to $filen exec 2>${filen} # stderr now goes to $filen exec 0<${filen} # connect stdin to $filen while read line do stuff done Also, consider: lu="ls -l /usr/spool/uucppublic" Then, $lu # type in the $ too. will execute ls -l /usr/spool/uucppublic. Is this what you wanted ? If you have to do some trick substitutions in a command, try eval. Here is a small shell script that uucp's a list of files to a predetermined location ($HOME/lvc/uucp) on another machine. case ${#} in 0|1) echo "usage: ${0} filen, ..., filen machine" >&2 ; exit 1 ;; *) eval "case \${$#} in cbsc[acefghklmn]|danews) uucp ${*}!~lvc/uucp ;; * ) echo ${0}: \${$#} invalid machine >&2 ; exit 1 ;; esac" ;; esac Hope this answers some of your questions. There are some undocumented features in the the shell, but you'll have enough work ahead of you learning the documented ones first. If you can get U of W to buy the code for the Korn Shell (only $2000 for the source) it's well worth the money. -- Larry Cipriani AT&T Network Systems danews!lvc "Nothing is worse than an itch you can never scratch."