Last active
March 4, 2016 15:10
-
-
Save OneOfOne/6598fd2f79145200b512 to your computer and use it in GitHub Desktop.
scp replacement using sftp because scp is a horrible piece of crap.
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/sh | |
# | |
# this script is under public domain, go nuts. | |
# originally posted by OneOfOne at https://gist.github.com/OneOfOne/6598fd2f79145200b512 | |
# | |
if [ "$#" -lt 2 ]; then | |
echo "usage: $0 files... [sftp args] host:/path" > /dev/stderr | |
exit 1 | |
fi | |
CMD="sftp -b -" | |
BATCH="progress\n" | |
while [[ $# > 0 ]] ; do | |
arg="$1"; | |
[ ! -f "$arg" ] && break | |
BATCH="${BATCH}put \"$arg\"\n" | |
shift | |
done | |
BATCH="${BATCH}bye\n" | |
#echo "echo -n $BATCH | $CMD $@" | |
echo -ne $BATCH | $CMD $@ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment