[kubuntu] Script to insert a line into a text file?

view story

http://ubuntuforums.org – How do I insert a line of text into a specific location in a text file? I'm trying to write a script that installs itself and a few other scripts that run at startup. I want to insert a line right above the "exit 0" in "/etc/rc.local" like this: Code: #!/bin/sh -e # # rc.local # # This script is executed at the end of each multiuser runlevel. # Make sure that the script will "exit 0" on success or any other # value on error. # # In order to enable or disable this script just change the execution # bits. # # By default this script does nothing. /path/to/scr (Hardware)