From 561e0b04a8e23b9088010d4b08f55683decf05db Mon Sep 17 00:00:00 2001 From: Christoph Anton Mitterer Date: Wed, 11 Oct 2023 06:07:47 +0200 Subject: =?UTF-8?q?[bash]=20Use=20`command`=20to=20=E2=80=9Cprotect?= =?UTF-8?q?=E2=80=9D=20further=20commands=20(#3462)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit causes all simple commands that are not built-ins or functions to be invoked via `command` in order to protect them from alias substitution or from accidentally taking functions of the same name. It was decided to not “protect” `fzf` and `fzf-tmux` for now. Maybe a better solution should be implemented for that in the future. Signed-off-by: Christoph Anton Mitterer --- shell/key-bindings.bash | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'shell/key-bindings.bash') diff --git a/shell/key-bindings.bash b/shell/key-bindings.bash index e57f2af8..c4dce3ba 100644 --- a/shell/key-bindings.bash +++ b/shell/key-bindings.bash @@ -21,7 +21,7 @@ __fzf_select__() { cmd="${FZF_CTRL_T_COMMAND:-"command find -L . -mindepth 1 \\( -path '*/.*' -o -fstype 'sysfs' -o -fstype 'devfs' -o -fstype 'devtmpfs' -o -fstype 'proc' \\) -prune \ -o -type f -print \ -o -type d -print \ - -o -type l -print 2> /dev/null | cut -b3-"}" + -o -type l -print 2> /dev/null | command cut -b3-"}" opts="--height ${FZF_TMUX_HEIGHT:-40%} --bind=ctrl-z:ignore --reverse --scheme=path ${FZF_DEFAULT_OPTS-} ${FZF_CTRL_T_OPTS-} -m" eval "$cmd" | FZF_DEFAULT_OPTS="$opts" $(__fzfcmd) "$@" | @@ -44,7 +44,7 @@ fzf-file-widget() { __fzf_cd__() { local cmd opts dir cmd="${FZF_ALT_C_COMMAND:-"command find -L . -mindepth 1 \\( -path '*/.*' -o -fstype 'sysfs' -o -fstype 'devfs' -o -fstype 'devtmpfs' -o -fstype 'proc' \\) -prune \ - -o -type d -print 2> /dev/null | cut -b3-"}" + -o -type d -print 2> /dev/null | command cut -b3-"}" opts="--height ${FZF_TMUX_HEIGHT:-40%} --bind=ctrl-z:ignore --reverse --scheme=path ${FZF_DEFAULT_OPTS-} ${FZF_ALT_C_OPTS-} +m" dir=$(set +o pipefail; eval "$cmd" | FZF_DEFAULT_OPTS="$opts" $(__fzfcmd)) && printf 'builtin cd -- %q' "$dir" } -- cgit v1.2.3