After seeing the reactions on Stack Overflow on this question and an unfamiliarity with qsub, I believe thqt U&L is better suited for this question.
In qsub, we can pass environment variables (a comma-separated list of envar=value pairs) like so:
info="This is some info"
qsub -v INFO=$info script.pbs
However, this becomes problematic when $info contains a comma.
info="This is some info, and here is some more!"
qsub -v INFO=$info script.pbs
This will trigger an error like so:
ERROR:
-v: variable ' and here is some more!' is not set in environment variables.
I have also tried encapsuling info, INFO="$info" leading to the same issue.
How can I pass $info correctly, even if it contains one or more commas? The same question holds with newlines which always end up incorrectly when they are passed (backslash gets removed).
Perhaps an interesting observation is that when I echo -e $info I get the output that I expect. The error is triggered in the qsub command specifically.
INFO=$infowill get word-split, likely makingis,someetc. taken as filenames. The result should be quite different with and without the quotes.