Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!ames!sun-barr!decwrl!shelby!kon@mycroft.Stanford.EDU From: kon@mycroft.Stanford.EDU (Ronnie Kon) Newsgroups: comp.unix.wizards Subject: Re: csh programming problem Message-ID: <53@mycroft.stanford.edu> Date: 16 Mar 90 02:42:01 GMT References: <53408@bbn.COM> Sender: kon@mycroft.STANFORD.EDU (Ronnie Kon) Organization: Stanford University Lines: 39 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 ... > First, apologies if this is a repeat of my earlier posting...we are having some trouble with getting our postings out. It seems to me that the best way to deal with this is to put an alias in your .cshrc, on the order of alias foobar "foo \!* \; bar \!*" This will do precisely what you want, and execute a whole lot faster. If you really need a shell script, you will need to echo the arguments through sed to put backslashes before any double or back quotes appearing in them, store the result into a variable, and then double quote the resulting variable on the command lines. This is really icky. In that this is pretty easilly discernable from the manual, I would agree that it would be more at home in questions than in wizards. -- ------------------------------------------------------------------------------- Ronnie Kon | "I don't know about your brain, ronnie@mindcraft.com | but mine is really bossy" ...!{decwrl,hpda}!mindcrf!ronnie | -- Laurie Anderson -------------------------------------------------------------------------------