On Sat, 18 Mar 2006 20:44:17 -0500, Paul Jarc wrote:
> 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
Great! That works. Unfortunately, the example I gave you was simplified
from my actual application (too big and confusing to post here). There is
another complication ... my variable has new-line characters embedded in
it so the "eval" above gets many invalid command errors. I need to replace
the new-lines with spaces. I will try the tr command.