OT - BASH question?

Peter Volsted pvolsted at image.dk
Fri Apr 15 23:24:19 UTC 2005


hi

Bill Gradwohl wrote:
> Does anyone know of a GOOD bash list? If yes - I'll go there.
> 
> The following works:
>    while read line; do
>    ...
>    ...
>    done < somefile
>    ...
>    ...
> 
> How would one go about doing something similar replacing the file 
> redirection with the output of a command? Before you say pipe it, that 
> doesn't work because the pipe starts a subprocess and anything done 
> inside the while loop is lost to the rest of the original process.
> 
> i.e.
>    ps -eo "%p" | while read line; do
>    ... # anything done here is
>    ... # lost to the original process
>    done
>    ... # Code here can't use anything
>    ... # done inside the while loop
> 
> Suggestions?
> 

ps -eo "%p" | awk ' { print $1 > "proctest" }'


-- 
good luck

     peter

TDC OCES CA: <http://www1.certifikat.dk/repository/ocesca.crt>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3701 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://listman.redhat.com/archives/fedora-list/attachments/20050416/8e6e9359/attachment-0001.bin>


More information about the fedora-list mailing list