4 ms·
It should be noted that the behavior of `echo` in this case is notable not standardized with regards to what should happen if `$1` starts with a dash, and wheth
by Blikkentrekker 6y ago
It should be noted that the behavior of `echo` in this case is notable not standardized with regards to what should happen if `$1` starts with a dash, and whether it should interpret several special control sequences or not.
It is for this reason that `echo` is generally frowned upon for programmatic input, and `printf %s "$1"` is recommended; as this is guaranteed to not interpret, and copy dash-leading strings to the output verbātim.
- geofft 6y agoPretty sure the behavior of echo is standardized on all machines that have notify-send installed.
- yjftsjthsd-h 6y agonotify-send works on Arch Linux, FreeBSD, and Alpine Linux, each of which uses a different echo(1).
- Blikkentrekker 6y agoYou would be wrong as pointed out below. Modern shells also typically have `echo` as a builtin and can have quite different behavior. https://stackoverflow.com/questions/33784892/bash-vs-dash-behavior-with-the-command-echo-ne-hello-n https://stackoverflow.com/questions/33784892/bash-vs-dash-be...