In Bash (or really any other shell), if I have an arbitrary string that I want to echo, how can I make it so the echo doesn't come out empty if the string is -n
, -e
, or -E
? I would expect something like echo -- -e
to work (stopping echo from interpreting any further options), but it doesn't.
Even explicitly specifying a flag doesn't stop it: echo -E -en
still gives no output.
Is it possible to be safe when using echo, or do I just have to switch all my echo calls to printf '%s\n'
?