Quote:
Originally Posted by gibsosmart
Now I want to goto that directory in a shell script
like
my_cd.sh "c:\windows\back\up"
should change my directory to
/windows/back/up in my putty session.
|
This version will change directories:
Code:
s="c:\windows\back\up"
s=${s/c:}
path=${s//\\//}
echo "Moving to $path"
cd $path
It's important that you realize the directory change won't normally persist after you exit the shell script. But there is a way to make this happen.
This example won't retain the directory change after the script exits:
This example will:
Code:
$ . ./script-name.sh
See the extra dot?