csh programming problem

Ivan Warner iwarner at axion.bt.co.uk
Thu Mar 15 20:27:58 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 ...
> 
> Unfortunately, this method does not work when $1 is something like 'a
b', since
> $1 evaluates to the string ( a b ) without the quotes, so foo and bar
> think that their first argument is 'a' and their second argument is 'b',
> rather than that their first argument is 'a b'.
> 
> My solution to this problem is to build a new argument list, "requoting" each
> argument, using this ugly piece of code:
> 
> [UGLY code deleted]


	what on earth is wrong with:

#!/bin/csh 
foo "$1" "$2"
bar "$1" "$2"

	have I missed some subtle point, or is this not a `wizards' question



More information about the Comp.unix.wizards mailing list