GAH! Bash script insanity

Joshua Pollak pardsbane at offthehill.org
Fri Jan 30 11:03:33 EST 2004


On Jan 28, 2004, at 9:31 PM, Chris Devers wrote:
>
>> I guess I want something like:
>>
>> RESULT=`sed -e s/#.*// ${CONFIG_FILE}` | `awk -F"=" '/${PARAMETER}/ {
>> print $2 }' `
>
> Are you sure?
>
> What if ${PARAMETER}="CMD" (for example), and the file has
>
>     CMD=rm -rf /
>
> ?

This (unless I'm mistaken) doesn't execute the line above. My 
understanding of it is that the value of RESULT will be 'rm -rf /', ie:

echo $RESULT
rm -rf /

which of course might be a bad idea, but doesn't actually execute 
anything.


-- 
Joshua Pollak
Software Engineer
Charles River Analytics
617-491-3474 x586




More information about the Discuss mailing list