Last active
November 8, 2017 14:01
-
-
Save xsnpdngv/39612f752f17cfd1166710454e4b035c to your computer and use it in GitHub Desktop.
FTP bash script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# ============================================================================ | |
# @file ftpsh | |
# @brief Script to execute command line arguments as FTP command | |
# @author Tamas Dezso <[email protected]> | |
# @date November 8, 2017 | |
# ============================================================================ | |
if [ $# -lt 1 ] | |
then | |
echo -e "\n Usage: $0 <ftp-command> [argument(s)]\n" | |
exit 1 | |
fi | |
HOST=hostname.com | |
USER=username | |
PASS=password | |
DIR=/home/$USER | |
echo "ftp://$USER@$HOST:$DIR$ $@" | |
ftp -in $HOST <<EOF | |
user ${USER} ${PASS} | |
cd ${DIR} | |
bin | |
$@ | |
bye | |
EOF | |
exit $? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment