diff options
| author | Tom Schwindl <schwindl@posteo.de> | 2022-08-20 12:30:24 +0000 |
|---|---|---|
| committer | Felix Van der Jeugt <felix.vanderjeugt@posteo.net> | 2022-11-29 22:42:16 +0100 |
| commit | 2cc906e3bf9d90a34732d3218c2edc76453f56b2 (patch) | |
| tree | 17919fbde0fc0c06a08d540a768311f19dc50fc5 /vis-open | |
| parent | b828b5b986a576196cda2ccba13579de96772ebd (diff) | |
| download | vis-2cc906e3bf9d90a34732d3218c2edc76453f56b2.tar.gz vis-2cc906e3bf9d90a34732d3218c2edc76453f56b2.tar.xz | |
make vis-open and vis-complete more POSIX compliant
This commit combines 3 commits:
- vis-open: `local' is not part of POSIX
(Author: Tom Schwindl <schwindl@posteo.de>)
- More POSIXisation.
(Author: Matěj Cepl <mcepl@cepl.eu>)
- Clean up of vis-complete as well.
(Author: Matěj Cepl <mcepl@cepl.eu>)
Diffstat (limited to 'vis-open')
| -rwxr-xr-x | vis-open | 8 |
1 files changed, 3 insertions, 5 deletions
@@ -9,9 +9,7 @@ VIS_MENU_PROMPT="" ALLOW_AUTO_SELECT=1 wrap_dirs() { - local o - - while read o + while read -r o do [ -d "$o" ] && printf "%s/\n" "$o" || printf "%s\n" "$o" done @@ -45,7 +43,7 @@ done # At this point, all the remaining arguments should be the expansion of # any globs that were passed on the command line. -if [ $# -eq 1 -a "$ALLOW_AUTO_SELECT" = 1 ]; then +if [ $# -eq 1 ] && [ "$ALLOW_AUTO_SELECT" = 1 ]; then # If there were globs on the command-line, they've expanded to # a single item, so we can just process it. @@ -55,7 +53,7 @@ if [ $# -eq 1 -a "$ALLOW_AUTO_SELECT" = 1 ]; then # full list, even if it's just an empty directory. cd "$1" IFS=$NL # Don't split ls output on tabs or spaces. - exec "$0" -p "$VIS_MENU_PROMPT" -f .. $(ls -1) + exec "$0" -p "$VIS_MENU_PROMPT" -f .. "$(ls -1)" else # We've found a single item, and it's not a directory, # so it must be a filename (or file-like thing) to open, |
