Help with Zip and FTP Shell Script

I am trying to combine zip and ftp upload in one script but for some reason I can't get it to work. It zips properly but does not ftp, seems like it just ignores ftp. Any help would be greatly appreciated. Thanks!

#!/bin/sh
cd /home/user/test
zip -r test.zip *
FOLDER='/home/user/test'
ZIPS=$(ls $FOLDER)
for F in $zips ; do
  while [ -n '$(lsof | grep $F' ] ; do
  sleep 1
done
ftp -n <<EOF
open 192.103.229.66
user user pass
binary
put test.zip
EOF
done

Probably best not to use ftp , and use either sftp or rync instead (processes which use ssh ).

... and then use sshpass .

See for example;

It doesn't ignore ftp , it just doesn't enter the loop as $zips is unset. *nix is case aware...

1 Like
Moderator comments were removed during original forum migration.