#! /bin/bash notebook="$(joplin ls / --sort updated_time | dmenu -i -l 30)" [ -z "$notebook" ] && exit 1; joplin use "$notebook" notes="$(joplin ls --sort updated_time --long)" index="$(echo "$notes" | cut -d" " -f4- | dmenu -n -ix -i -l 30 || exit 1)" [ -z "$index" ] && exit 1; line="$(($index + 1))" id="$(echo "$notes" | sed "${line}q;d")" echo "$id" joplin edit "$id"