#!/usr/bin/ksh
if [ $# -ne 1 ]; then
echo "[*]\t Please see usage..."
echo "[*]\t Usage: $0 <store_number>"
exit 1
fi
if [ -z "$1" ]; then
echo "[*]\t Please see usage..."
echo "[*]\t Usage: $0 <store_number>"
exit 1
fi
Store_Number=$1
EPS_Directory="/apps/epsadmin_90000"$Store_Number"/EPS"
cd $EPS_Directory
I am trying to write a simple script that will change my directory in my main shell. I have it working to change directory within the sub-shell (shown above), but obviously when the script is done running it kicks me back out to the outer shell and I am back in my original directory.
Is it possible to pass a command to the outer shell, from within a sub-shell? Can I pass a cd command to the outer shell?
For example if I run:
./cd.sh 2001
I would like my directory to be:
/apps/epsadmin_900002001/EPS
Once I return to the outer shell.