huyng/bashmarks

`g` should exit noisily, and with a non-zero error code, when trying to go to undefined bookmark

broofa opened this issue · 1 comments

Failing silently (by defaulting to the user's home directory) is unexpected and dangerous. For example:

cd nonexistant_dir && rm *
-bash: cd: nonexistant_dir: No such file or directory
# Didn't accidentally delete files in the current directory, yay!

whereas ...

g undefined_alias && rm *

Fuck, we just deleted all the files in whatever the current directory was :(

What should happen ...

cd nonexistant_dir && rm *
-bashmarks: g: no alias for 'nonexistant_dir'
# rm command should not execute here

@broofa @daveharris 's merged pull request resolves this issue in commit 6c3ee80.