diff options
| author | Sebastiano Tronto <sebastiano@tronto.net> | 2023-06-20 23:01:09 +0200 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano@tronto.net> | 2023-06-20 23:01:09 +0200 |
| commit | 581865ee0c8b8aea872f053d804a41fb5f416b17 (patch) | |
| tree | 9a2f99ea48c31629a5c3c42b0454483982cdbfed /dmenu-filepicker | |
| parent | c5d101ab2c9db3b1a001cb56953cb90b24f8fdcf (diff) | |
| download | scripts-581865ee0c8b8aea872f053d804a41fb5f416b17.tar.gz scripts-581865ee0c8b8aea872f053d804a41fb5f416b17.zip | |
Various shellcheck fixes (www.shellcheck.net)
Diffstat (limited to '')
| -rwxr-xr-x | dmenu-filepicker | 13 |
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 | ||
| 7 | menu="dmenu -i -l 15" | 8 | menu="dmenu -i -l 15" |
| 8 | 9 | ||
| 10 | usage() { | ||
| 11 | echo "Usage: dmenu-filepicker [-m MENU] [PATH]" | ||
| 12 | } | ||
| 13 | |||
| 9 | while getopts "m:" opt; do | 14 | while 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 |
| 15 | done | 24 | done |
| 16 | shift `expr $OPTIND - 1` | 25 | shift $((OPTIND - 1)) |
| 17 | 26 | ||
| 18 | fullpath=$(realpath ${@:-"$(pwd)"}) | 27 | fullpath=$(realpath "${@:-"$(pwd)"}") |
| 19 | 28 | ||
| 20 | while true; do | 29 | while true; do |
| 21 | if [ "$sel" = "." ]; then | 30 | if [ "$sel" = "." ]; then |
