I have a string like
$ str="abc 'e f g' hij"
and i wish to get whole e f g
part of it. In other words, i wish to tokenize the string according to shell parameter rules.
Currently, i am doing that as
$ str="abc 'e f g' hij"; (eval "set -- $str"; echo $2)
but this is totally unsafe if a single *
gets outside of '
-ticks.
Any better solutions?