aboutsummaryrefslogtreecommitdiff
path: root/dmenu-filepicker
diff options
context:
space:
mode:
authorSebastiano Tronto <sebastiano@tronto.net>2023-06-20 23:01:09 +0200
committerSebastiano Tronto <sebastiano@tronto.net>2023-06-20 23:01:09 +0200
commit581865ee0c8b8aea872f053d804a41fb5f416b17 (patch)
tree9a2f99ea48c31629a5c3c42b0454483982cdbfed /dmenu-filepicker
parentc5d101ab2c9db3b1a001cb56953cb90b24f8fdcf (diff)
downloadscripts-581865ee0c8b8aea872f053d804a41fb5f416b17.tar.gz
scripts-581865ee0c8b8aea872f053d804a41fb5f416b17.zip
Various shellcheck fixes (www.shellcheck.net)
Diffstat (limited to '')
-rwxr-xr-xdmenu-filepicker13
1 files changed, 11 insertions, 2 deletions
diff --git a/dmenu-filepicker b/dmenu-filepicker
index e2642b2..288cac9 100755
--- a/dmenu-filepicker
+++ b/dmenu-filepicker
@@ -2,20 +2,29 @@
2 2
3# A dmenu-based file picker (prints selected file to stdout) 3# A dmenu-based file picker (prints selected file to stdout)
4# Requires: dmenu (or similar) 4# Requires: dmenu (or similar)
5
5# Usage: dmenu-filepicker [-m menu] [path] 6# Usage: dmenu-filepicker [-m menu] [path]
6 7
7menu="dmenu -i -l 15" 8menu="dmenu -i -l 15"
8 9
10usage() {
11 echo "Usage: dmenu-filepicker [-m MENU] [PATH]"
12}
13
9while getopts "m:" opt; do 14while getopts "m:" opt; do
10 case "$opt" in 15 case "$opt" in
11 m) 16 m)
12 menu="$OPTARG" 17 menu="$OPTARG"
13 ;; 18 ;;
19 *)
20 usage
21 exit 1
22 ;;
14 esac 23 esac
15done 24done
16shift `expr $OPTIND - 1` 25shift $((OPTIND - 1))
17 26
18fullpath=$(realpath ${@:-"$(pwd)"}) 27fullpath=$(realpath "${@:-"$(pwd)"}")
19 28
20while true; do 29while true; do
21 if [ "$sel" = "." ]; then 30 if [ "$sel" = "." ]; then

Generated with cgit - Back to sebastiano.tronto.net