You are attempting to print -n
which is interpreted as an argument to disable printing of the trailing newline.
Here printf
comes handy:
$ printf "%s" "-n"
-n
If you want a newline after n
,
$ printf "%s\n" "-n"
-n
An ugly way using echo
would be to use the octal value for the hyphen, i.e. -
,
$ echo -e '\055n'
-n
The -e
argument enables interpretation of backslash escapes.