Artificial intelligent assistant

Does input redirection (<) append a newline character? I was originally of the impression that $ ./myprog moo[CTRL-D] is exactly the same as $ echo moo > cow $ ./myprog < cow But I found that `myprog` always counts one more `\n` in the second version than in the first. Why is this? Turns out `wc` does the same thing... $ wc -l moo[CTRL-D]0 (Apparently zero lines is possible?) $ echo moo > cow $ wc -l < cow 1 Can anyone explain this to me?

`echo` appends a newline, unless you tell it not to, by putting `-n` first or `\c` at the end, or putting `-e` first _and_ `\c` at the end or... you really don't want to know all the varieties of echo. Use `printf moo > cow` and you'll have a file with zero lines.

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy eaf5263b4760a1e88527af47ad7699fc