stored on a hard drive.
Here's a script that you can read and it should be self-explanatory.
Code: Select all
#!/bin/sh
# SCRIPT SHOWS HOW TO ADD LINES TO HEAD OF FILE
# first create a file
echo "Here is data
in file." > DATA_file
# then create the text to add to top of file
TEXT=`echo -e "I WANT THIS TEXT \nON TOP \n \n "`
# now add the two together
cat - DATA_file <<<"$TEXT" > /tmp/temp_script_data
mv -f /tmp/temp_script_data DATA_file
# show resulting file with default editor
defaulttexteditor DATA_file
exit 0
_________________________________________________