I am currently writing a command that allows me to appending a '#' in line of a text to help me disable a script (main.sh) from calling a sub-script (test.sh)
I have managed to get it working like this:
sed -i 's:./test.sh:#./test.sh:g' main.sh
however i need to have another script to have the '#' removed to re-enable the call.
and it works like this:
sed -i 's:#./test.sh:./test.sh:g' main.sh
it works ok assuming that the first command is only run once, however should it be run multiple times (in this case 4 times), this is the output:
as a result the second script needs to be run 4 times in to remove all instances of '#'.
How should i approach this?
Should i fix the first script to ensure only one # is allowed to be appended prior to test.sh? or
should i fix the second script to ensure all instances of '#' are removed before test.sh?
appreciate any help as i am still relatively new to SED.