Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!mephisto!udel!princeton!phoenix!pfalstad From: pfalstad@phoenix.Princeton.EDU (Paul John Falstad) Newsgroups: comp.unix.shell Subject: Re: pipes within a script Message-ID: <3022@idunno.Princeton.EDU> Date: 3 Oct 90 04:45:43 GMT References: <1263@umvlsi.ecs.umass.edu> Sender: news@idunno.Princeton.EDU Distribution: usa Organization: Princeton University, Princeton, New Jersey Lines: 50 In article <1263@umvlsi.ecs.umass.edu> breck@umvlsi.ecs.umass.edu (Liam Breck) writes: >I'm trying to write a C shell script in which I step through a bunch Ah, there's your problem. csh is horrible for shell scripts. Use sh or ksh. ># >foreach dir (~/tex/ ~/tax/) > foreach file_ext (.aux .dvi .log .toc) > nohup echo $dir*$file_ext > end > end >| rm You can't do this in csh, as far as I know. Even if you can, you should use a /bin/sh script like this: #! /bin/sh rm `for dir in $HOME/tex/ $HOME/tax/; do for ext in .aux .dvi .log .toc; do echo $dir*$file_ext done done | grep -v \\\*` or else: #! /bin/sh for dir in $HOME/tex/ $HOME/tax/; do for ext in .aux .dvi .log .toc; do echo $dir*$file_ext done done | grep -v \\\* | xargs rm If you must use csh, do something like: set nonomatch echo {~/tex/,~/tax/,~/foo/}*.{aux,dvi,log,toc} | grep -v \\\* | xargs rm or set nonomatch rm `echo { ... } | grep -v \\\*` What was the nohup for, may I ask? ----- Here is the address to complain to: pfalstad@phoenix.princeton.edu PLink:HYPNOS GEnie:P.FALSTAD CIS: 70016,1355 That address again, sync@thumper.princeton.edu PLink:OHS738 GEnie:OHS738 CIS: 4128 143 1234 937