I need to pass a string to a program as its argument from the Bash CLI, e.g
program \"don\'t do this\"
The string may include any character
You won't find a faster or more efficient way than:
eval RESULT=\$\'$STRING\'
For one, this is the kind of thing that eval is there for, and you avoid the crazy cost of forking subprocess all over the place, as the previous answers seem to suggest. Your example:
$ foo='\u25b6'
$ eval bar=\$\'$foo\'
$ echo "$bar"
▶