From 1bf3e25a2cc23866a6f7485a3e15f28af05d82ef Mon Sep 17 00:00:00 2001 From: Koichi Murase Date: Fri, 12 Jul 2024 01:45:08 +0900 Subject: [PATCH] Do not enable it in non-interactive shells --- bash-preexec.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/bash-preexec.sh b/bash-preexec.sh index 641346a..7c69d3c 100644 --- a/bash-preexec.sh +++ b/bash-preexec.sh @@ -47,6 +47,11 @@ if [[ -z "${BASH_VERSINFO-}" ]] || (( BASH_VERSINFO[0] < 3 || (BASH_VERSINFO[0] return 1 fi +# We do not enable bash-preexc in non-interactive shells +if [[ $- != *i* ]]; then + return 0 +fi + # Avoid duplicate inclusion if [[ -n "${bash_preexec_imported:-}" || -n "${__bp_imported:-}" ]]; then return 0