brianbolton.me

home

Creating a file inline in Bash

28 Feb 2014

By necessity and sometimes by choice, I’ve been using the command prompt more in Mac OS X. I found this handy trick to create files on the command line.

cat > filename << EOF
The contents
of your file 
go here.
EOF

You can replace EOF with any string that signifies the end of your file. EOF is a good choice because it should not appear inside of the file contents.