25.1. Creating a quick file

Here’s a quick way to create a file with some text in it:

						$ cat >> myfile <<NEWFILE
					

Now type some text, and when you have finished simply type NEWFILE on a new line and you have got yourself a file called myfile, containing some text.

If you supply a filename that already has some text in it, the contents you type in will append to the original file.

If you use the tab key, please note that some older shell versions do not preserve the meaning of tabs. To overcome this simply use a hyphen after the two left angled brackets, like this.

cat >> myfile <<- NEWFILE ... 

Get Linux and Unix Shell Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.