This
STR=\"Hello\\nWorld\" echo $STR
produces as output
Hello\\nWorld
instead of
Hello Wo
I find the -e flag elegant and straight forward
-e
bash$ STR="Hello\nWorld" bash$ echo -e $STR Hello World
If the string is the output of another command, I just use quotes
indexes_diff=$(git diff index.yaml) echo "$indexes_diff"