Skip to content

Commit 6a28205

Browse files
gaelicWizardrcaloras
authored andcommitted
Declare arrays
Since the precmd_functions and preexec_functions arrays won't be actually defined until __bp_install, which is called only during the first $PROMPT_COMMAND, declare empty arrays for these parameters. This ensures that the shell is aware these things exist, which helps avoud unbound parameters failures in other scripts which depend upon this package.
1 parent 552d266 commit 6a28205

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

bash-preexec.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,10 @@ __bp_adjust_histcontrol() {
9090
# and unset as soon as the trace hook is run.
9191
__bp_preexec_interactive_mode=""
9292

93+
# These arrays are used to add functions to be run before, or after, prompts.
94+
declare -a precmd_functions
95+
declare -a preexec_functions
96+
9397
# Trims leading and trailing whitespace from $2 and writes it to the variable
9498
# name passed as $1
9599
__bp_trim_whitespace() {

0 commit comments

Comments
 (0)