Skip to content

Commit

Permalink
Do not enable it in non-interactive shells
Browse files Browse the repository at this point in the history
  • Loading branch information
akinomyoga committed Jul 11, 2024
1 parent 8926de0 commit 1bf3e25
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions bash-preexec.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 1bf3e25

Please sign in to comment.