#!/bin/bash url="http://localhost:3000" # Generated at /settings TOKEN="" set -e # Exit on error 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)) # Set the API endpoint URL # {"id":"clel2nl7b0003p0scejnggjar","title":"test","visibility":"unlisted","password":"","createdAt":"2023-02-26T07:30:48.215Z","updatedAt":"2023-02-26T07:30:48.215Z","deletedAt":null,"expiresAt":null,"parentId":null,"description":"","authorId":"clc4babr80000p0gasef3i5ij"}⏎ # Set the bearer token header="Authorization: Bearer $TOKEN" # Set the JSON payload json=$( cat <