#!/bin/bash # usage # ./upload.sh -t "title" -v "visibility" -p "password" file1 file2 file3 url="https://drift.lol" # Generate one at /settings (don't worry, this ones been revoked) TOKEN="" # Exit on error set -e visibility="unlisted" title="Untitled" password="" description="" # Parse command line arguments while getopts ":t:d:v:p:" opt; do case ${opt} in t) title="$OPTARG" ;; d) DEBUG=1 ;; v) visibility="$OPTARG" ;; p) password="$OPTARG" ;; # debug option with -D \?) echo "Invalid option -$OPTARG" 1>&2 exit 1 ;; :) echo "Option -$OPTARG requires an argument" 1>&2 exit 1 ;; esac done shift $((OPTIND - 1)) header="Authorization: Bearer $TOKEN" json=$( cat <