Hello I have a tiny bit of a problem. In bash I need to use some equivalent of double quotes inside double quotes (or the other way around.)
I need to run the following statement to get the output of foo and store it in a variable while passing foo the $file which probably contains spaces.
Code:
variable=$(foo "$file")
The problem is that foo might return an empty string and if it does I need to catch it which will not happen unless I quote the whole thing.
Code:
variable="$(foo "$file")"
but you can't have double quotes inside double quotes for obvious reasons. (no difference between open and close symbols)
I thought that it might not mess up because it would try to find the result of the whole $() first but it doesn't it just tries to do '$(foo '
Is there any way to escape it just for the $() but not send the quotes escaped to foo?
Thanks for any help.