I’m a shell noob. I’m trying to write a simple script that’ll take a screen shot and upload it to my server, this all works great when I do it line by line in my terminal, but when I try to achieve this via my simple script the file that gets uploaded seems to be corrupted. I’ve compared the two files (the corrupted file that gets uploaded as a result of my script and the non-corrupted file that gets uploaded when I do this manually) in a hex editor and their nearly identical… but not. Any idea what’s happening to my images when I run the script that isn’t happing when I do the same thing line by line in the terminal?
here’s my script:
#!/bin/sh
screencapture -x ~/Desktop/screencap.png
HOST='mysite.com'
USER='myUsrName'
PASSWD='myPassWord'
DIR='DESKTOP_CAPS'
FILE='screencap.png'
ftp -n $HOST <<END_SCRIPT
quote USER $USER
quote PASS $PASSWD
cd $DIR
put $FILE
quit
END_SCRIPT
exit 0
thanks!!!
use
binarycommand to set the mode of file transfer to binary(the binary mode transmits all eight bits per byte and thus provides less chance of a transmission error and must be used to transmit files other than ASCII files)