I have
var="arg1"" arg2"" arg3"
and I want to use it against a a command as such below
java $VAR"
And the above works, but I read that the safer way for variable substitution is quoting it and hence I tried
java "$VAR"
. The problem with this is that all the arguments get treated as one argument.
I read a lot of solutions that talk about using arrays, but that is limited to Bash like shells. Some talked about eval
but from the number of comments to that I have come to know it's insecure. Some talked about setting a different IFS
- I thought about reading IFS
and using that to separate my args
in $VAR
. But the IFS
on that system already had space in it.(So at a loss here about that).
Is there a cross-shell approach to achieve what I want, in a safe way? Or should I roll back to just java $VAR