These days I've been solving the task of sending the bunch of files specified by unix filespec convention (all metacharacters allowed) to the remote host using ftp. I'm thinking of such concept/design, where the main bash script executes the following subtasks:
(1) Expansion of command line arguments to the filelist (file1, file2, ..., fileN);
(2) Opening the FTP client (ftp) on background;
(3) Establishing the connection with the "host";
(4) Sending the file1, file2, ..., fileN in the way one-by-one with an echoing the action and its result into the stdout;
(5) Closing the FTP session running as a child process on background;
(6) That's all folks!
The first 3 subtasks I've done (at least I hope), but I can't write the code for checking the success of file transmission. I have never solved such task before, but I feel that there must be the way/technique in bash how to do it. I was searching on web forums for help, but they mainly recomanded to use expect (tcl relativ script language). I'm sure it can be achieved without expect.
I hope somebody can give me just a little hint to move forward. If it's not clear don't hesitate ask me here or contact me via PM. Many thanks in advance.
p.s.: Sorry for my English.