csh programming problem
Jaap Vermeulen
jaap at sequent.UUCP
Thu Mar 15 14:55:28 AEST 1990
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
>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
>(I am open to suggestions concerning how to improve this)
foo $1:q $2:q
bar $1:q $2:q
or:
foo $*:q
which is equivalent to
foo $@
in bourne shell
>This solves the original problem, but there are still more problems to
>solve-- like handling quoted characters. If I call this program with
>$1 as \'foo, the backslash will be peeled off and my quoting scheme will
>break. Similar problems will arise if I try to use other characters that
>have special meaning to the shell.
This should take care of all quoting etc.
jaap.
--
"Some call me Jaaper" +---------------------------+
| Sequent Computers Systems |
Internet : sequent!jaap at uunet.uu.net | Beaverton, Oregon |
Uucp : ...uunet!sequent!jaap +---------------------------+
More information about the Comp.unix.wizards
mailing list