Hi all. In a php application I'm writing under Redhat 9 I'm using php's system() function to execute a shell script.
This shell script takes two variables, an old directory location and a new directory location, and should move the old directory to the new directory.
Here's the script:
# $1 original directory name
# $2 new directory name
# set site webroot
if [ ! -d $SITE ] ; then
elif [ ! -d $SITE$1 -o -d $SITE$2 ] ; then
# exit 30
mv $SITE$1 $SITE$2
So the executing command would be
mv /path/to/web/root/and/olddirectory/ /path/to/web/root/and/newdirectory/
When this script executes it returns an exit code of 1 (even if I wrap $SITE$1 $SITE$2 in quotes), but if I comment out the mv command and uncomment the exit 30 line, it returns an exit value of 30.
I've been looking in my reference manuals but I can't seem to find what the exit code 1 for the mv command is.
The only thing I can see is that it might be is a syntax error in the mv command, but if that's it I'm lost as to what it is. I've executed the mv command from the command line, using the value of $SITE and $1 and $2 and it works fine.
If anyone can shed some light on what this could be I would greatly appreciate it. I realize that it's probably something quite small but I'm relatively new to shell scripting under Linux so any help would be great.
Thanks in advance,