Files
scripts/restore_history.sh
T
2026-09-29 15:24:09 -04:00

15 lines
490 B
Bash
Executable File

#!/usr/bin/env bash
# Restore the real history file after running book examples
# Check for a backup file
if [ -f ~/.bash_history.backup ]; then
# Rename the backukp file as the current file
mv ~/.bash_history.backup ~/.bash_history
# Clear the example history
history -c
# Reload the history from the restored file
history -r
echo -e "\e[1;36mThe original history has been restored\e[0m"
else
echo -e "\e[1;33mThere is no backup history to restore\e[0m"
fi