You could probably do this with a number of languages (i.e. Sed, Awk, Perl,
etc.) but, I know of no way to do something similar to a redirect append
(>>) that will prepend your information. If anybody else knows of a way,
(other than coding in some language) I'd love to hear it, but I *think*
you'll find that it doesn't exist.
Your best bet would be to code it yourself (i.e. using a temp file and such
like you mentioned). If your worried about the user terminating your script
before you've had a chance to clean up any temp files you may have created
then I would suggest trapping the interrupt, quit and Terminate signals (2,3
and 15 respectively), using something like this:
trap 'cleanup' 2 3 15
This will 'trap' the specified signals and call the cleanup function when it
does. This function could then clean up any temp files that your script
created.
-----Original Message-----
From: Jim Reimer [mailto:[EMAIL PROTECTED]]
Sent: Monday, July 17, 2000 3:58 PM
To: [EMAIL PROTECTED]
Subject: prepend?
Is there any convenient / straightforward way to add lines to the
beginning of a text file (without using temp files, renaming, etc)?
(something similar to ">>" but the other way around)
-jdr-
-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to [EMAIL PROTECTED]
Please read the FAQ at http://www.linux-learn.org/faqs
-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to [EMAIL PROTECTED]
Please read the FAQ at http://www.linux-learn.org/faqs