0

What is the difference between running the echo command with argument passed in quotes v/s without quotes?

echo -e hi\n    # Output = hin
echo -e "hi\n"  # output = hi  (with extra new line)
echo -e hi\\n   # output = hi  (with extra new line)

I want to understand the difference between the above 3 commands and how the bash interprets them?

P.S - I am trying to explore the echo command with the option -e

  • 3
    In the bash manual, read [3.1.2 Quoting](https://www.gnu.org/software/bash/manual/bash.html#Quoting) and [3.5.9 Quote Removal](https://www.gnu.org/software/bash/manual/bash.html#Quote-Removal) and of course [`echo`](https://www.gnu.org/software/bash/manual/bash.html#index-echo) and [`printf`](https://www.gnu.org/software/bash/manual/bash.html#index-printf) – glenn jackman Nov 13 '20 at 14:49
  • 1
    Also here you could look for `echo -e` and `echo` and `printf` in general: https://unix.stackexchange.com/questions/65803/why-is-printf-better-than-echo – thanasisp Nov 13 '20 at 16:41

0 Answers0