I need to parse a variable to get substrings. Some substrings are quoted to include imbedded blanks.
Please inspect the following:
Code:
[~] $ echo $record
aaa "bbb bbb" ccc
[~] $ set $record
[~] $ echo $2
"bbb
OK, so the quotes do not work.
So I tried the following:
Code:
[~] $ eval set $record
[~] $ echo $2
bbb bbb
It worked !!
Now I put this into a shell script, and it reverts to the unwanted behavior above, as though the "eval" were not there.
Is it bash or is it me? Can someone help?