When I run the following command from the terminal:
echo -n hello >> output.txt
It appends 'hello' to the file and doesn't add a trailing newline, which is what I want it to do.
However, if I have a file named prog.sh
with that exact same line as its sole contents, and run it from terminal with
sh prog.sh
then it appends '-n hello' to the file with a trailing newline.
I have run scripts using this before, and it has never been a problem. What am I missing?