Created
October 7, 2015 23:33
-
-
Save chrisb13/432eade90ec68629d03a to your computer and use it in GitHub Desktop.
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
function servername_push() | |
{ | |
if [[ ( $# -eq 0 ) || ( $1 == "--help" ) || ( $1 == "-h" ) ]] ; then | |
echo "Usage: servername_push PATH_FROM PATH TO." | |
echo "Purpose: rsync function to push files to servername." | |
echo " " | |
echo "Mandatory arguments: " | |
echo "PATH_FROM: Path on local to Rsync from" | |
echo "PATH_TO: Path on server to Rsync to" | |
echo " " | |
echo "Example." | |
echo "This:" | |
echo "servername_push ./temp/* /home/server/path/" | |
echo " " | |
echo "Becomes:" | |
echo "rsync -avz --progress ./temp/* [email protected]:/home/server/path/" | |
return 1 | |
fi | |
#grabs last passed argument.. | |
for last; do true; done | |
#grabs all arguments but the last one... | |
#echo ${@:1:$(($#-1))} | |
rsync -avz --progress ${@:1:$(($#-1))} [email protected]:$last | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment