Use the printf command:
printf '%s\n' "$var"
echo is suitable for simple cases, but it can behave strangely for certain arguments. For example, echo has the -n option, which tells it not to print a new line. If $var turns out to be -n , then
echo "$var"
doesn't print anything. And there are several different versions of echo (either built into different shells, or like /bin/echo ) with subtly different behavior.
Keith thompson
source share