csh programming problem

Ronnie Kon kon at mycroft.Stanford.EDU
Fri Mar 16 12:42:01 AEST 1990


In article <53408 at bbn.COM> ellard at BBN.COM (Dan Ellard) writes:
>I am trying to write a shell script that takes several arguments and
>passes them to child processes, i.e.
>
>#!/bin/csh
>foo $1 $2 ...
>bar $1 $2 ...
>exit 0
>
>which I want to have the same effect as if I had typed to the shell:
>foo $1 $2 ...
>bar $1 $2 ...
>

	First, apologies if this is a repeat of my earlier posting...we are
having some trouble with getting our postings out.

	It seems to me that the best way to deal with this is to put an
alias in your .cshrc, on the order of

		alias foobar	"foo \!* \; bar \!*"

This will do precisely what you want, and execute a whole lot faster.

	If you really need a shell script, you will need to echo the arguments
through sed to put backslashes before any double or back quotes appearing in
them, store the result into a variable, and then double quote the resulting
variable on the command lines.  This is really icky.

	In that this is pretty easilly discernable from the manual, I would
agree that it would be more at home in questions than in wizards.


-- 
-------------------------------------------------------------------------------
Ronnie Kon				|     "I don't know about your brain,
ronnie at mindcraft.com			|     but mine is really bossy"
...!{decwrl,hpda}!mindcrf!ronnie	|		-- Laurie Anderson
-------------------------------------------------------------------------------



More information about the Comp.unix.wizards mailing list