The following is a snippet of a larger script I'm attempting. I just want this part to recognize the argument is a directory and then cd to that directory: i.e ./larj /etc.
#!/bin/ksh
# Filename: larj.sh
if [ $# -gt 1 ]; then
    echo "0 or 1 arguments allowed."
    exit
fi
if [ -f "$1" ]; then
    echo "directory only."
    exit
else
    if [ -d "$1" ]; then
        cd $1
    fi
fi
When I run the script with /etc as the argument, it appears nothing happens; it stays in the same directory with no error. Anyone have any suggestions how to get it to change directories?
Thanks
 
     
     
    