I want to use sed to strip the leading "./" from multiple strings in a bash script. I tried this:
search='\.\/'; replace=''; sed -i '' "s#$search#$replace#" ${MYVAR}/script.sh
but it didn't work. The command exited without errors, but the "./" was not removed.
However, running the same bash command twice in a row worked.
If anyone can help clear this up it would be really helpful, i.e. why the command fails when run once, but works when run twice in a row