I cant seem to get the "cd" command to execute within an if statement. This is what I have:
#!/bin/sh
PRJ=$1
if [ $PRJ = wm ]; then
cd /projects/wm/work/$USER
else
echo "project directory not found"
fi
If i replace the "cd" line with an echo command the script works:
#!/bin/sh
PRJ=$1
if [ $PRJ = wm ]; then
echo "this works"
else
echo "project directory not found"
fi
#!/bin/sh
PRJ=$1
if [ $PRJ = wm ]; then
cd /projects/wm/work/$USER
else
echo "project directory not found"
fi
If i replace the "cd" line with an echo command the script works:
#!/bin/sh
PRJ=$1
if [ $PRJ = wm ]; then
echo "this works"
else
echo "project directory not found"
fi