aboutsummaryrefslogtreecommitdiff
path: root/vis-open
diff options
context:
space:
mode:
Diffstat (limited to 'vis-open')
-rwxr-xr-xvis-open18
1 files changed, 9 insertions, 9 deletions
diff --git a/vis-open b/vis-open
index cb81b04..920239c 100755
--- a/vis-open
+++ b/vis-open
@@ -40,11 +40,6 @@ if [ $# -eq 1 -a "$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.
- # If the file or directory does not exist, abort.
- if [ ! -e "$1" ]; then
- exit 1
- fi
-
if [ -d "$1" ]; then
# Recurse and show the contents of the named directory,
# We pass -f to force the next iteration to present the
@@ -54,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