Open AtkinsSJ opened 4 months ago
Just to avoid confusion since the correct output wasn't mentioned, echo "\n"
should output the string "\n" literally (i.e. "\n" as a json string) unless the -e
flag is specified, in which case it does output a line feed.
For example,
echo "\n\n\n\n\n"
emits only a single newline, becauseecho
always emits a newline after its output. When that string reachesecho
as a positional argument, the newline escapes are gone.As another example,
echo "hello\nfriends\n"
currently outputs this from aconsole.log()
call:As you can see,
args
is 'hellofriends' without the escapes.