unset HISTIGNORE HISTFILE=$TMPDIR/bashhist-$$ set -o history set -o histexpand echo one for f in a b c; do echo !! done history history -c echo two for f in a b c; do echo !-1 done history set +o history rm -f $HISTFILE