Very similar to this question.
I'm iterating through a few things with an automated script in BASH. Occasionally the script will come across "-n" and echo will attempt to interpret this.
Attempted this:
$ POSIXLY_CORRECT=1 /bin/echo -n
and
$ POSIXLY_CORRECT=1 /bin/echo "-n"
But it interpreted the argument each time.
Then this, which works but it's possible to hit escaped characters in the strings, which is why I don't want to apply a null character to all input and use -e.
$ echo -e "\x00-n"
-n
printf is possible, but is to be avoided unless there are no other options (Not all machines have printf as a utility).
$ printf "%s" "-n"
-n
So is there a way to get echo to print "-n"?