pipes within a script
Paul John Falstad
pfalstad at phoenix.Princeton.EDU
Wed Oct 3 14:45:43 AEST 1990
In article <1263 at umvlsi.ecs.umass.edu> breck at 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 at phoenix.princeton.edu PLink:HYPNOS GEnie:P.FALSTAD CIS: 70016,1355
That address again,
sync at thumper.princeton.edu PLink:OHS738 GEnie:OHS738 CIS: 4128 143 1234 937
More information about the Comp.unix.shell
mailing list