From bash manpage
Double-quoted closing characters preserve the literal meaning of all characters within quotation marks, except for $, `, \, and when the story extension is enabled,!.
With that in mind, how does echo -ne "\n" create a new line? Won't the shell expand "\ n" before it is passed to echo ?
I thought this might work because echo is inline, so the shell is smart enough to do the right thing. However, even calling external /usr/bin/echo -ne "\n" works.
What is even more curious is that no matter what I do, double quote or single quote \n , the following two commands show that bash passes \\n as an argument:
$ strace /usr/bin/echo "\n" 2>&1 | head -n1 execve("/usr/bin/echo", ["/usr/bin/echo", "\\n"], []) = 0 $ strace /usr/bin/echo '\n' 2>&1 | head -n1 execve("/usr/bin/echo", ["/usr/bin/echo", "\\n"], []) = 0
What's going on here?
source share