Created
January 28, 2022 16:29
-
-
Save kugland/95d97be58788c9afc1fb20f4d89999a8 to your computer and use it in GitHub Desktop.
Create pastes on termbin.com
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
#!/bin/sh | |
while getopts "h" option; do | |
case "$option" in | |
h) | |
echo "termbin - Create pastes on termbin.com" | |
echo | |
echo "Usage: termbin [OPTIONS] [FILE] [FILE] ..." | |
echo | |
echo "Options:" | |
echo " -h Show this help" | |
echo | |
echo "When no FILE is specified, termbin reads from stdin." | |
echo | |
exit 0 | |
;; | |
'?') | |
echo "Usage: termbin [OPTIONS] [FILE] [FILE] ..." | |
echo "For help, type: termbin -h" | |
exit 1 | |
;; | |
esac | |
done | |
shift $((OPTIND - 1)) | |
if [ $# -eq 0 ]; then | |
nc termbin.com 9999 | |
else | |
for file in "$@"; do | |
printf "%s" "$file: " | |
nc termbin.com 9999 <"$file" | |
done | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment