bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Question about variables and for loop


From: Paul Jarc
Subject: Re: Question about variables and for loop
Date: Sat, 18 Mar 2006 20:44:17 -0500
User-agent: Gnus/5.110003 (No Gnus v0.3) Emacs/21.4 (gnu/linux)

Bob <bob@dont.spam.me> wrote:
>       XXX='a "b c" d'
>       for x in $XXX ; do
>               echo $x
>       done

XXX='a "b c" d'
eval "set $XXX"
for x in "$@" ; do
        echo $x
done

If the first element in XXX might start with "-", then it takes a
little more work to ensure it isn't misinterpreted as an option to
"set":
eval "set x $XXX"
shift


paul




reply via email to

[Prev in Thread] Current Thread [Next in Thread]