Skip to content

Instantly share code, notes, and snippets.

@minhaz1 minhaz1/
Created Mar 30, 2015

What would you like to do?
alias for transfer
transfer() {
if [ $# -eq 0 ]; then
echo "No arguments specified. Usage:"
echo "$ transfer /tmp/"
echo "$ cat /tmp/ | transfer"
return 1
# write to output to tmpfile because of progress bar
tmpfile=$( mktemp -t transferXXX );
if tty -s; then
basefile=$(basename "$1" | sed -e 's/[^a-zA-Z0-9._-]/-/g');
curl --progress-bar --upload-file "$1" "$basefile" >> $tmpfile;
curl --progress-bar --upload-file "-" "$1"
cat $tmpfile;
cat $tmpfile | xargs echo -n | pbcopy;
rm -f $tmpfile;
alias transfer=transfer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.