#!/bin/bash # prepend.sh: Add text at beginning of file. # # Example contributed by Kenny Stauffer, #+ and slightly modified by document author. E_NOSUCHFILE=85 read -p "File: " file # -p arg to 'read' displays prompt. if [ ! -e "$file" ] then # Bail out if no such file. echo "File $file not found." exit $E_NOSUCHFILE fi read -p "Title: " title cat - $file <<<$title > $file.new echo "Modified file is $file.new" exit # Ends script execution. from 'man bash': Here Strings A variant of here documents, the format is: <<