Skip to content

Instantly share code, notes, and snippets.

@a-gu
Last active October 12, 2019 02:49
Show Gist options
  • Save a-gu/a3b677c0e45dc6767d451bd3a4b73d5c to your computer and use it in GitHub Desktop.
Save a-gu/a3b677c0e45dc6767d451bd3a4b73d5c to your computer and use it in GitHub Desktop.
Upload a file to File.io using a bash function in "~/.bash_functions"
#!/usr/bin/env bash
# Upload file to File.io (optional expiration)
# fio file_name [expiration]
fio () {
if [[ "$#" -ge "2" ]]; then
curl -F "file=@$1" "https://file.io/?expires=$2";
elif [ "$1" = "-h" ] || [ "$1" = "--help" ]; then
echo "Uploads a file to file.io"
echo
echo -n "Usage: fio file_name [expiration]"
elif [[ "$#" -ge "1" ]]; then
curl -F "file=@$1" "https://file.io";
else
echo "Invalid arguments";
echo
echo -n "Use \"fio --help\" for help";
fi
echo;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment