From 581865ee0c8b8aea872f053d804a41fb5f416b17 Mon Sep 17 00:00:00 2001 From: Sebastiano Tronto Date: Tue, 20 Jun 2023 23:01:09 +0200 Subject: Various shellcheck fixes (www.shellcheck.net) --- dmenu-filepicker | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'dmenu-filepicker') diff --git a/dmenu-filepicker b/dmenu-filepicker index e2642b2..288cac9 100755 --- a/dmenu-filepicker +++ b/dmenu-filepicker @@ -2,20 +2,29 @@ # A dmenu-based file picker (prints selected file to stdout) # Requires: dmenu (or similar) + # Usage: dmenu-filepicker [-m menu] [path] menu="dmenu -i -l 15" +usage() { + echo "Usage: dmenu-filepicker [-m MENU] [PATH]" +} + while getopts "m:" opt; do case "$opt" in m) menu="$OPTARG" ;; + *) + usage + exit 1 + ;; esac done -shift `expr $OPTIND - 1` +shift $((OPTIND - 1)) -fullpath=$(realpath ${@:-"$(pwd)"}) +fullpath=$(realpath "${@:-"$(pwd)"}") while true; do if [ "$sel" = "." ]; then -- cgit v1.3