I am trying to make an automatic installer which downloads file from ftp and installs it on system .
Host = "zzz "
USER= "ss"
PASSWD = " xxXX"
FILE = " *.tar"
ftp $HOST << EOF
user $USER
passwd $PASSWD
---#to save in folder /tmp
cd /tmp
mget $(ls -t | head -1) --# to get last file
EOF.
Is this code is proper? And how will I know that the download has finished? Should I make any code changes for that? Because as soon as its finished downloading I have to install it using sudo dpkg. How to use this command in my existing code which I have written above?

myapp-latest.deb), and then make your script download that. – elias Jan 8 at 18:56