Skip to content

Commit 5a7c25f

Browse files
committed
cd: check that a glob match is successful
Globs that match nothing expand to themselves. This causes `cd --clean` to have this unwanted behavior: ~ $ cd --mounts ~ $ cd --clean cd: unmounting *... still in use; not unmounting See: http://mywiki.wooledge.org/NullGlob
1 parent 19b9ec9 commit 5a7c25f

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

cd

+2
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,8 @@ function cd_lsof_mountpoints {
303303
function cd_clean_mountpoints {
304304
local still_waiting=0
305305
for mountpoint in ~/.cd/mountpoints/*; do
306+
[[ -e $mountpoint ]] || break
307+
306308
# The ! -e check is for wonky FUSE mounts that have gotten into an
307309
# inconsistent state.
308310
if [[ ! -e "$mountpoint" || -d "$mountpoint" ]]; then

0 commit comments

Comments
 (0)