Text Link Ads

Sunday, September 16, 2007

Tip for the day: INSERTING LINES WITHIN SCRIPTS

If you want to insert a line at the top (or anywhere for that matter) of a file within a shell script, use the ed editor.

EXAMPLE:

string="hello"
ed << EOF
e any_file
1i
${string}

No comments: