I wrote my script using the the directory ~/deleted (it's a long script). after using ~/deleted for the whole script. I want to let the user choose the directory by putting the path in ~/.rm.cfg.
My file starts like this:
#!/bin/bash
defaultpath=~/deleted
if [ -s ~/.rm.cfg ]
then
defaultpath=$(head -1 ~/.rm.cfg)
fi
I need to replace every ~/deleted with $defaultpath in my script. Is there a way to do it in command line such that it saves and replaces the original file?
I can't get either perl or sed to work.
sedshould suffice. What did you try?