Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove all history manipulation #117

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 14 additions & 5 deletions 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+(both|space)* ]]
then
echo "bash-preexec is unable to determine full command line when \$HISTCONTROL contains 'ignorespace' (or 'ignoreboth')." >&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 Expand Up @@ -225,10 +232,12 @@ __bp_preexec_invoke_exec() {
fi

local this_command
this_command=$(
export LC_ALL=C
HISTTIMEFORMAT= builtin history 1 | sed '1 s/^ *[0-9][0-9]*[* ] //'
)
if [[ "$HISTCONTROL" == *ignore+(both|space)* ]]
then
this_command="${BASH_COMMAND:-}"
else
this_command=$( LC_ALL=C HISTTIMEFORMAT= builtin history 1 | sed '1 s/^ *[0-9][0-9]*[* ] //' )
fi

# Sanity check to make sure we have something to invoke our function with.
if [[ -z "$this_command" ]]; then
Expand Down