A question for all you shell experts:
I have a simple config file like:
And I have a piece of code like:
The output is:
What I would like is for '$FRED' to be visible outside the while loop. I have tried using export, set, xargs. I think it is a problem with 'while' running in a subshell. Anyone know of a simple way of getting the variable outside of the loop?
Thanks in advance,
Neil
I have a simple config file like:
Code:
PEOPLE = fred bill ted
Code:
while read GROUP DELIM MAILS
do
eval $GROUP='$MAILS'
echo $FRED
done < file
echo $FRED # problem is here
Code:
fred bill ted
<blank line>
What I would like is for '$FRED' to be visible outside the while loop. I have tried using export, set, xargs. I think it is a problem with 'while' running in a subshell. Anyone know of a simple way of getting the variable outside of the loop?
Thanks in advance,