Skip to content

Instantly share code, notes, and snippets.

@kugland
Created January 28, 2022 16:29
Show Gist options
  • Save kugland/95d97be58788c9afc1fb20f4d89999a8 to your computer and use it in GitHub Desktop.
Save kugland/95d97be58788c9afc1fb20f4d89999a8 to your computer and use it in GitHub Desktop.
Create pastes on termbin.com
#!/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