I have an issue driving me bonkers. I have a ksh script that requires changing directories. If a argument "TEST" is passed in, this is a regression test execution of the script (as opposed to production execution). I have a directory entitled "TEST" that is located three directory locations ABOVE where the script resides.
If I determine my current path using pwd, I am able to retrieve the current directory. I then append the following path info to the value retrieve with pwd. For example:
mypath=`pwd`
echo "DBG - my path is: " $mypath
This displays
/home/joec/dev/solution/tools/libsearch.
I then append the following to the $mypath variable:
rbase=$mypath/../../../lib/$test/profiles
Where $test is the value passed in on the command line.
The problem I am having is this. I perform a check to see if the argument being passed in exists as a directory. The
if [[ -d $rbase ]]; then checks to see if the directory for the TEST directory $rbase exists. The problem I am encountering is that the script is not processing the ".." to move up the directory tree. As a result, even though the path for $rbase exists, the ksh script is returning the value that it doesnt and thus exits the script incorrectly.
Is there something that I am (subtly) missing?