csh programming problem

Scott Yelich scott at cs.odu.edu
Thu Mar 15 12:26:16 AEST 1990


>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'.

foo "$@"
bar "$@"
--

 -----------------------------------------------------------------------------
 Scott D. Yelich                                 scott at cs.odu.edu [128.82.8.1]
 After he pushed me off the cliff, he asked me, as I fell, ``Why'd you jump?''
 -----------------------------------------------------------------------------



More information about the Comp.unix.wizards mailing list