Path: utzoo!attcan!uunet!mcsun!ukc!axion!axion.bt.co.uk!iwarner From: iwarner@axion.bt.co.uk (Ivan Warner) Newsgroups: comp.unix.wizards Subject: Re: csh programming problem Message-ID: <1990Mar15.102758.17051@axion.bt.co.uk> Date: 15 Mar 90 10:27:58 GMT References: <53408@bbn.COM> Sender: news@axion.bt.co.uk Reply-To: iwarner@axion.bt.co.uk (Ivan Warner) Organization: British Telecom Research Labs Lines: 32 In article <53408@bbn.COM>, ellard@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