What’s happening here :
$ echo $SHELL /bin/bash $ echo -e "foo" foo $ which echo /bin/echo $ /bin/echo -e "foo" -e foo
The last output is expected to be “foo”, like when using echo directly.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
/bin/echois a program, and it’s different from the Bash built-inechocommand.According to the POSIX standard,
echoshould not take any arguments. The Bashechocommand doesn’t follow this standard, and the GNU Coreutils version doesn’t either. Other versions may be more strict.Try to find out what version
/bin/echois by calling it with the--versionflag or see if it gives you some help with the--helpflag.Also,
man whichshows this:Bash is not strictly POSIX-conformant so the return value of
whichmay differ (and it does in this case because of theechobuilt-in).For further reading, see the answers to echo outputs -e parameter in bash scripts. How can I prevent this?