I have been trawling the WWW for some time now, trying to find an answer to my problem.
I'm writing a shell script (bourne) intended for backing up a database on a remote phpbb bulletin site (ftp access only) and moving the backup to a local machine.
Right now I can generate a DB dump on the remote site and ftp it to my local machine using ncftpget.
The problem is when I try to parse the output from ncftpget in order to determine how the transfer went.
The command is executed like this from within the script :
PS=`/usr/bin/ncftpget -u UserName -p SomePassWord -V www.somesite.com . /store/auto_backup/*.sql.gz`
echo "Echo : $PS"
In the case of an error (wrong pass) the command will output this if run directly from the shell:
/usr/bin/ncftpget -u SomeUser -p WrongPass -V www.somesite.com . /store/auto_backup/*.sql.gz
ncftpget: cannot open www.somesite.com: username and/or password was not accepted for login.
The error is never stored in the $PS variable and thus cannot be evaluated.
I have written other scripts that did not have this problem...
I know this may seem like a trivial problem to some, but I have been scratching my head quite a bit trying to figure this one out.
Any comments/feedback appreciated!