Path: utzoo!attcan!uunet!tut.cis.ohio-state.edu!cs.utexas.edu!rice!uw-beaver!zephyr.ens.tek.com!tektronix!sequent!jaap From: jaap@sequent.UUCP (Jaap Vermeulen) Newsgroups: comp.unix.wizards Subject: Re: csh programming problem Message-ID: <31291@sequent.UUCP> Date: 15 Mar 90 04:55:28 GMT References: <53408@bbn.COM> Reply-To: jaap@sequent.UUCP (Jaap Vermeulen) Organization: Sequent Computer Systems, Inc Lines: 42 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 >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@uunet.uu.net | Beaverton, Oregon | Uucp : ...uunet!sequent!jaap +---------------------------+