3 ms·
If a file has a line ending in it, is it truly empty?
by dylan604 7y ago
If a file has a line ending in it, is it truly empty?
- fwip 7y agoThe -n flag keeps echo from emitting a line ending.
- dylan604 7y agodoh! I read it as \n, but then that's for other languages, so i was just all sorts of not paying attention
- mappu 7y agoI used a distro in recent memory where `echo -n foo` really produced `-n foo`. The workaround was `printf "%s" foo`.
- fwip 7y agoAh yeah, posix doesn't require -n to do anything in particular. For most use cases, strict adherence to posix compatibility isn't important, but sometimes it really really is.