I tried the following script to give myself convenience in changing directories to different hard disk partitions. But after its execution, the default location does not change, but if I use command line, location change is successful, as shown below. Can anybody help?
john@X61s:~$ pwd
/home/john
john@X61s:~$ vi chdir
john@X61s:~$ ./chdir c
here ... 1
john@X61s:~$ pwd
/home/john
john@X61s:~$ cd /media/john/90F8-0AAE/
john@X61s:/media/john/90F8-0AAE$
The script chdir is the following
#! /bin/bash
dir=$1
if [[ $dir = 'c' ]]; then
echo 'here ... 1'
cd /media/john/90F8-0AAE/
elif [[ $dir = 'd' ]]; then
echo 'here ... 2'
cd /media/john/E5A9-932C
elif [[ $dir = 'e' ]]; then
echo 'here ... 3'
cd /media/john/56de0045-aa0e-4b69-8270-44b4ec866fa2/
else
echo "$dir not defined"
exit
fi