* [EMAIL PROTECTED]
> > NAME=`IFS=':'
> > cat /etc/passwd | while read a b c d; do
> > if [[ "$a" == "root" ]]; then
> > echo $c
> > fi
> > done`
> >
> That's a good tip - thank you! However, that only works if we're
> talking about 1 env variable. In my work it was actually a number of
> arrays, and I don't thik there's an easy way to implement that along
> the same lines. And a good tip in return: instead of `command` use
> $(command) - this notation can be nested!
Thanks.
You can, in our situation do something like:
while read a b c d; do
case "$a" in
root)
export R="ok"
;;
daemon)
export D="ok"
;;
esac
done < /etc/passwd
And your "side effects" remain.
(But I buy the point of portable scripting anyway.)
--
Jon Haugsand, [EMAIL PROTECTED]
http://www.norges-bank.no
--
redhat-list mailing list
unsubscribe mailto:[EMAIL PROTECTED]?subject=unsubscribe
https://listman.redhat.com/mailman/listinfo/redhat-list