Skip to content

Commit bc8bfe4

Browse files
committed
Warn user if $HISTCONTROL is modified
Warn the user on stderr if we need to modify `$HISTCONTROL`, but first check if our warning should be suppressed by the user setting `$__bp_suppress_histcontrol_warning` to something.
1 parent 10b41c5 commit bc8bfe4

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

bash-preexec.sh

+8-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,14 @@ __bp_adjust_histcontrol() {
8080
if [[ "$histcontrol" == *"ignoreboth"* ]]; then
8181
histcontrol="ignoredups:${histcontrol//ignoreboth}"
8282
fi;
83-
export HISTCONTROL="$histcontrol"
83+
84+
if [[ -z "${__bp_suppress_histcontrol_warning:-}" && "$HISTCONTROL" == *ignore+(dups|space)* ]]
85+
then
86+
echo "bash-preexec is unable to determine full command line when \$HISTCONTROL contains 'ignorespace' (or 'ignoreboth')." >&2
87+
echo "Those options have been removed from \$HISTCONTROL." >&2
88+
fi
89+
90+
HISTCONTROL="$histcontrol"
8491
}
8592

8693
# This variable describes whether we are currently in "interactive mode";

0 commit comments

Comments
 (0)