#!/bin/bash set -e PW= PW_FILE="${HOME}/.mediapw" BASE_URL="https://fs.noahro.at" function get_pw { cat "$PW_FILE" } function main { PW="$( get_pw )" local path="$1" fetch "$path" } function fetch { local path="$( pathencode "$1" )" #local path="$1" curl -s "${BASE_URL}/${path}?pw=${PW}&t" #--expand-url \ #--variable %path --variable %PW \ } function pathencode { #jq --slurp --raw-input --raw-output @uri <<<"$@" sed -E 's/ /%20/g' <<<"$@" | \ sed -E 's/,/%2C/g' } main "$@"