Easy(?) problem for shell script writers
Richard M. Mathews
richard at locus.com
Sat May 11 10:41:46 AEST 1991
scott at prism.gatech.EDU (Scott Holt) writes:
>moore at emily.uvm.edu (Bryan Moore) writes:
>>I want to do a 'ps | fgrep $1' where $1 is each of the above
>>strings, but obviously the above is incorrect.
>sounds like you want something to the effect of:
>PARAMETERS=`awk ...` - those are accent characters
>if [ "$PARAMETERS" ]
>then
> for i in $PARAMETERS
> do
> ps | fgrep $i
> done
>else
> echo "Awk found nothing"
>fi
But do you really want to run "ps" repeatedly for each string? And do you
want a line of "ps" output to be printed multiple times if more than one
string appears in that line? How about:
awk ... > /tmp/foo.$$
ps | fgrep -f /tmp/foo.$$
rm -f /tmp/foo.$$
(or set up a "trap" to do the "rm", so the temp file gets removed even if
the script is killed by a signal).
Richard M. Mathews Freedom for Lithuania
richard at locus.com Laisve!
lcc!richard at seas.ucla.edu
...!{uunet|ucla-se|turnkey}!lcc!richard
More information about the Comp.unix.aix
mailing list