Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Amnesia.io bash alias
amn() {
if [ $# -ge 1 -a ! -f $1 ]; then
input=$(cat -)
temp=$(mktemp)
echo $input > $temp
curl -sF "file=@$temp;filename=xyz.$1" https://amnesia.io
rm $temp
elif [ $# -ge 1 -a -f $1 ]; then
curl -sF "file=@$1" https://amnesia.io
else
echo "No filename provided (amn [filename])"
echo "Try:"
echo "amn [filename]"
echo "or"
echo "pbpaste | amn [filetype]"
echo "More info: https://amnesia.io"
return 1
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment