I'm having trouble with escaping characters in bash. I'd like to escape single and double quotes while running a command under a different user. For the purposes of this question let's say I want to echo the following on the screen:
'single quote phrase' "double quote phrase"
How can I escape all the special chars, if I also need to switch to a different user:
sudo su USER -c "echo \"'single quote phrase' \"double quote phrase\"\""
Of course, this doesn't produce the right result.
bash -c "echo \"'single quote phrase' \\\"double quote phrase\\\"\""