echo
by itself displays a line of text. It will take any thing within the following "..."
two quotation marks, literally, and just print out as it is. However with echo -e
you're making echo
to enable interpret backslash escapes. So with this in mind here are some examples
INPUT: echo "abc\n def \nghi"
OUTPUT:abc\n def \nghi
INPUT: echo -e "abc\n def \nghi"
OUTPUT:abc
def
ghi
Note: \n
is new line, ie a carriage return. If you want to know what other sequences are recognized by echo -e
type in man echo
to your terminal.
echo -e
is not defined by POSIX and probably varies by shell.man echo
to read the manual forecho
.