diff options
| author | Marc André Tanner <mat@brain-dump.org> | 2018-02-28 19:53:28 +0100 |
|---|---|---|
| committer | Marc André Tanner <mat@brain-dump.org> | 2018-02-28 19:53:28 +0100 |
| commit | fdb56b003c9e0a00ded2878b0c174a7780bb39b2 (patch) | |
| tree | 2f10670e311cfb379cbde19c26c200c0c29ac478 /vis-open | |
| parent | 113a6a6a84198432ed9258f4abd5ec490a64c518 (diff) | |
| parent | 0be1e2e70b797e7e3149d777a26bc69966079e07 (diff) | |
| download | vis-fdb56b003c9e0a00ded2878b0c174a7780bb39b2.tar.gz vis-fdb56b003c9e0a00ded2878b0c174a7780bb39b2.tar.xz | |
Merge branch 'vis-open-fixes' of https://github.com/kj/vis
Diffstat (limited to 'vis-open')
| -rwxr-xr-x | vis-open | 13 |
1 files changed, 9 insertions, 4 deletions
@@ -49,10 +49,15 @@ if [ $# -eq 1 -a "$ALLOW_AUTO_SELECT" = 1 ]; then 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. - cd "$(dirname "$1")" - echo "$(pwd -P)"/"$(basename "$1")" - exit 0 + # so it must be a filename (or file-like thing) to open, + # unless the parent directory does not exist. + if [ -d "$(dirname "$1")" ]; then + cd "$(dirname "$1")" + echo "$(pwd -P)"/"$(basename "$1" | sed 's/\*$//')" + exit 0 + else + exit 1 + fi fi fi |
