#!/usr/bin/env bash set -x SEL="$(xsel)" BOOKMARK_ID="$(buku "$SEL" -f 1 --tacit | tail -n +2 | awk '{print $1}')" # tail to trim unwanted "waiting for input" output from buku https://github.com/jarun/Buku/blob/d60d56bc9f7f5e1410e99dc8bb4e35abf5068a14/buku#L4619 if [[ ! -z "$BOOKMARK_ID" ]]; then echo "Archiving $BOOKMARK_ID." buku -u "$BOOKMARK_ID" --tag - ril buku -u "$BOOKMARK_ID" --tag + simple-archive else echo "Bookmark for '$SEL' not found." exit 1 fi