[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: read output of process into a variable
From: |
Stefan Palme |
Subject: |
Re: read output of process into a variable |
Date: |
30 Jan 2008 15:51:23 GMT |
User-agent: |
Pan/0.132 (Waxed in Black) |
Thanks for your reply.
> It is not a bug in bash. it is just how it works.
I know, but did not find a gnu.bash.help newsgroup :$
> do this:
>
> result=""
> while read line; do
> extracteddata=`echo "$line" | sed -e 's/X/Y/'` result="$result
> $extracteddata"
> done < <(/usr/bin/output_generator)
> /usr/bin/another_tool "$result"
Nice... ;-)
In real life even "/usr/bin/output_generator" is not only
a call to one program, but a piped command consisting of
three or four steps, which makes the whole thing unreadable
again.
But I guess I can create and use a function containing the
"output_generator" chain...
> BTW: I would use $() syntax instead of the backtic syntax; just easier
> to see.
Ok...
Thanks and regards
-stefan-