Last active
October 12, 2019 02:49
-
-
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"
This file contains hidden or 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
#!/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