Sam's Blog entries for category 'note-to-future-me'
Shell-quoting future me, printf -v "%q" is what you're looking for
Date: Friday, 15 June 2012, 12:59.
Categories: bash, shell-scripting, note-to-future-me.
Note to future me: Are you trying to remember how to shell-quote/escape the contents of a variable to avoid going utterly insane from the nested double-quotes and backslashing?
printf -v escaped_var "%q" "$var"
is the command
that you can never remember, and never find the documentation
for until you've wasted a morning of your life.
Don't forget it next time. Or at least, remember that you wrote this note, kthxbai.