Skip to content

Instantly share code, notes, and snippets.

@zwily
Created September 13, 2015 17:59
Show Gist options
  • Save zwily/78ee19953f50f4b1dc4b to your computer and use it in GitHub Desktop.
Save zwily/78ee19953f50f4b1dc4b to your computer and use it in GitHub Desktop.
#!/bin/bash
if [ $# -ne 1 ]; then
echo "Usage: download.sh file ..."
exit 1
fi
for fn in "$@"
do
if [ -r "$fn" ] ; then
printf '\033]1337;File=name='`echo -n "$fn" | base64`";"
wc -c "$fn" | awk '{printf "size=%d",$1}'
printf ":"
base64 -w 0 < "$fn"
printf '\a'
else
echo File $fn does not exist or is not readable.
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment