buggy ftp upload script
As I understand it, the following scripts should work automatically without human intervention when I enter "./tarnobla.sh". However I am prompted to enter the password and then the second script seems to stumble on the password and sees it as an "invalid command".
----- this is file tarnobla.sh: #!/bin/bash cd /var/www tar cvpzf bunobla /home/nobla/* ftp < /home/nobla/Desktop/ftpnobla ----- this is file ftpnobla: open myisp username password cd .. cd f8e6 binary lcd /var lcd www put bunobla bye The site is password protected and used only as a backup. After I enter the password, the script works properly. Can anyone point me to the mistake? Thank you for your help. |
Use the -n switch on the ftp command line. Use the user command as described in:
Code:
man ftp |
Thank you for the tip, I will try that.
|
You could also try:
Code:
... |
A potential problem with jschiwal's solution is that it places the password on the command line, making it readable by anyone on the same system through the ps command.
|
It looks like my best option is to use the .netrc file as explained in the man page but it is good to know the other commands that can be used when automation is not required.
Thank you all. |
All times are GMT -5. The time now is 05:49 AM. |