A while back, I was uploading a bunch of stuff via FTP and needed a FTP script to automate things. However, I couldn’t find a clear example script out there and this simple script ended up taking quite a bit longer to write.
Anyway, for anyone who’s searching out there for a FTP script example, here’s something you may appreciate:
#!/bin/bash #... # (Other commands in script) # ... ftpCmd="open someserverdomain.com 21 user aUser aPassword passive bin cd uploads mput * bye " echo "$ftpCmd"|ftp -niv
The tricked as you can see is to store the FTP commands into a variable, then echo that to the "ftp" command.
Have fun FTP-ing, lol.