From 955036b4e902e7bf842b751bd06957d366a6e674 Mon Sep 17 00:00:00 2001 From: Anders Sildnes Date: Fri, 10 May 2019 10:53:42 +0200 Subject: [PATCH] Use "builtin cd" instead of just "cd" Similar to https://github.com/juven/maven-bash-completion/pull/68 In case someone has overloaded the "cd" command (with alias), the plugin's behaviour can be odd. E.g. if a cd alias also types in "ls" after "cd", the autocompletion will spew out directory contents each time user hits tab. --- bash_completion.bash | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bash_completion.bash b/bash_completion.bash index 34f5906..68960bc 100755 --- a/bash_completion.bash +++ b/bash_completion.bash @@ -66,13 +66,13 @@ _realpath () if [[ -f "$1" ]] then # file *must* exist - if cd "$(echo "${1%/*}")" &>/dev/null + if builtin cd "$(echo "${1%/*}")" &>/dev/null then # file *may* not be local # exception is ./file.ext # try 'cd .; cd -;' *works!* local tmppwd="$PWD" - cd - &>/dev/null + builtin cd - &>/dev/null else # file *must* be local local tmppwd="$PWD"