btoone
4/3/2012 - 3:54 AM

Creating files with text from the command line

Creating files with text from the command line

# Use ctrl + d to exit write mode when using cat
cat > file.txt    # overwrites
cat >> file.txt   # appends

echo "Text to write in file" > file.txt
echo "Text to write in file" >> file.txt
echo -e "line one\nline two\n\tindented text" > file.txt