kskp kskp - 1 month ago 7
Linux Question

Why doesn't my simple echo command not work?

I just gave a simple

echo
command on centos 7 command line:

echo "what is the worst thing someone has said to you about cloth diaper ? ( hopefully nothing ) here's mine !! :..."


It threw an error:

-bash: syntax error near unexpected token `('


Can someone please elaborate?

Answer

double quotes allows shell to expand variables, for example !! has a special meaning. If you want to treat everything as text, use single quotes instead.

For example;

$ date
Thu Oct  6 11:14:59 EDT 2016

$ echo "!!"
echo "date"
date

$ echo '!!'
!!
Comments