I searched the forum as there are already a lot of similar posts, but I cannot find an answer to my problem.
I have an issue with using sed inside the bash script. I set one of the variables to the value I'm passing as an argument to sed, but I get this error:
sed: -e expression #1, char 1: unknown command: `''
this is what is inside my bash script that is relevant to this part:
currentPath="\"/home/user/SYNC_A\",";
newPath="\"/home/user/SYNC_B\",";
sedArg="'s|userDir:""$currentPath""|userDir:""$newPath""'|"
sed -i "$sedArg" /home/user/settings.js
this is what I see when I use echo $sedArg
's|userDir:"/home/user/SYNC_A",|userDir:"/home/user/SYNC_B",|' /home/user/settings.js
When I copy and paste this into the command line it works fine, also when I copy what is printed by echo into the bash script it is working fine. Anybody is able to explain this to me in lame terms so I can find down what I'm doing wrong?