Add existing scripts
This commit is contained in:
1 parent
2ab5a42c2b
commit
3c05d74104
31 files changed
+1138
No files matched your search
Executable
+23
@@ -0,0 +1,23 @@
|
||||
#!/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
|
||||
Reference in new issue
Block a user