Hacker News new | ask | show | jobs
by mruts 2650 days ago
Such an insane default. Currently programming a bittorrent client and was edited files to test some functionality. Was confused for a long time until I realized nano was turning my "echo 'this is a test' > test" into "echo 'this is a test\n' > test"
3 comments

Running "echo 'this is a test' > test" produces a file with a newline at the end.
Pretty sure nano was changing your code to

    echo 'this is a test' > test\n
and then echo was adding the newline because you didn't specify -n.
...and also

  echo 'this is a test\n'
doesn't produce an additional new line because -e wasn't specified.
Funny you mention echo, which prints a newline by default as well.