23 lines
777 B
Bash
Executable File
23 lines
777 B
Bash
Executable File
#!/usr/bin/env bash
|
|
# Load the example history provided by the Effective Shell book
|
|
|
|
# If the book examples aren't available, load them
|
|
if [ ! -d ~/effective-shell ]; then
|
|
echo -e "\e[0;36mCopying Effective Shell example files\e[0m"
|
|
curl effective.sh | sh
|
|
fi
|
|
|
|
# Check if there is a backup of the history file already
|
|
if [ ! -f ~/.bash_history.backup ]; then
|
|
# if not, make a backup of the file
|
|
cp ~/.bash_history ~/.bash_history.backup
|
|
# copy the example history
|
|
cp ~/effective-shell/data/history.txt ~/.bash_history
|
|
# clear the history
|
|
history -c
|
|
# reload the history
|
|
history -r
|
|
echo -e "\e[1;31mThe history file has been backed up and test data staged\e[0m"
|
|
else
|
|
echo -e "\e[1;33mThere is already a history file backup\e[0m"
|
|
fi |