Creating a file without a newline

I recently was at a tech event where there was some discussion about newlines in templates. I pointed out that relying on implicit newlines in template files can lead to problems. The short discussion ended with a statement that files always end in a newline, and people moved on.

So, here's an example how you can bring a file without newlines into existence, even without an editor.

$ echo -ne "foo" > bar
$ wc -l bar
0 bar
$ cat bar 


Start a new thread

Cancel reply
Markdown. Syntax highlighting with <code lang="php"><?php echo "Hello, world!"; ?></code> etc.
DjangoPythonBitcoinTuxDebianHTML5 badgeSaltStackUpset confused bugMoneyHackerUpset confused bugX.OrggitFirefoxWindowMakerBashIs it worth the time?i3 window managerWagtailContainerIrssiNginxSilenceUse a maskWorldInternet securityFontGnuPGThunderbirdJenkins