Hi,
My target file is example.conf (which is actually $5, a variable in bash)
Code:
ConfigLine1 Option1 Option2
ConfigLine2 Option1 Option2
ConfigLine3 Option1 Option2 Option3
So I'm running this..
sed "1 c\ConfigLine1 $3 Option2=$1\\" /etc/3732/$5
$3 & $5 being variables defined when executing the command (./bash.sh Variable1 Variable2 Variable3 Variable4 Variable5)
My main issue, is that this one command will work perfectly fine, but I need to run 3 different sed commands (replace 3 different lines) with this bash script.
I've tried 3 different lines/commands, I've tried one line with the -e option, I've tried putting each command into an entirely new bash script and executing them manually..
But no matter what I do, the end result is an unchanged file - Although with one of the methods above the file is effected by the last sed, but only the last sed. Its as if each sed command edits the ORIGINAL and overwrites changes from the previous sed command, which makes NO sense to me, because I've also tried to split the commands into separate files which would fix that type of issue.
I've sat here for hours trying EVERYTHING. I've searched for a solution as much as possible, and after reading countless LQ threads I decided to create my own.
Just so everyone knows, I'm going to be passing these variables via ssh2_connect with PHP though this shouldn't make any real difference.
Please provide me with a solution, things like this really cause a halt in my productivity.