O'Reilly logo

Linux and Unix Shell Programming by David Tansley

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ... 

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required