Skip to content

Commit

Permalink
Warn user if $HISTCONTROL is modified
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
gaelicWizard committed Jul 28, 2021
1 parent 3e0e9b5 commit 612a512
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion bash-preexec.sh
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,14 @@ __bp_adjust_histcontrol() {
if [[ "$histcontrol" == *"ignoreboth"* ]]; then
histcontrol="ignoredups:${histcontrol//ignoreboth}"
fi;
export HISTCONTROL="$histcontrol"

if [[ -z "${__bp_suppress_histcontrol_warning:-}" && "$HISTCONTROL" == *ignore+(dups|space)* ]]
then
echo "bash-preexec is unable to determine full command line when \$HISTCONTROL contains 'ignoredups' or 'ignorespace'." >&2
echo "Those options have been removed from \$HISTCONTROL." >&2
fi

HISTCONTROL="$histcontrol"
}

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

0 comments on commit 612a512

Please sign in to comment.