#!/bin/sh # Script for downloading images without extension in qutebrowser (For example, images from Misskey) # You should bind "hint links spawn --userscript image-download {hint-url}" (to ',d' for example) # Downloaded images located at Downloads directory cd ~/Downloads EXT=$(wget $1 2>&1 | grep "image" | grep -oP '\[\K[^\]]+' | grep -oP '.*image/\K.*') FILE=$(echo "$1" | grep -oP '.*/\K.*') mv "$FILE" "$FILE.$EXT"