In fact, the echo command cannot be used with absolute safety here. If the variable contains -n for example, echo will consider that an option, rather than data to be printed. The only absolutely sure way to print the value of a variable is using print:
printf "%s\n" "$foo"source
When I type:
var="-n Hello" echo "$var" It works properly and doesn't interpret -n as an option, so I don't understand why the source I quoted says that we need to use printf to be absolutely safe?