-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(bash): Add function to reset bash history
- Loading branch information
Showing
3 changed files
with
29 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
if [[ -n "$ZSH_VERSION" ]]; then | ||
source "$(dirname "$0")/../shared.sh" | ||
else | ||
source "$(dirname "${BASH_SOURCE[0]}")/../shared.sh" | ||
fi | ||
prevent_to_execute_directly | ||
|
||
bash_reset_history_and_logs() { | ||
echo "Clearing Bash history..." | ||
history -c | ||
rm -f ~/.bash_history | ||
touch ~/.bash_history | ||
|
||
echo "Reloading the history.." | ||
history -r | ||
|
||
if [ -f ~/.lesshst ]; then | ||
echo "Clearing .lesshst file..." | ||
rm -f ~/.lesshst | ||
fi | ||
if [ -f ~/.viminfo ]; then | ||
echo "Clearing .viminfo file..." | ||
rm -f ~/.viminfo | ||
fi | ||
|
||
echo "History and logs have been cleared." | ||
echo "History has been reloaded in the current session." | ||
echo "For complete effect on all terminals, you may want to log out and log back in." | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
# Functions to work with shfmt | ||
|
||
if [[ -n "$ZSH_VERSION" ]]; then | ||
source "$(dirname "$0")/../shared.sh" | ||
else | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
# Functions to work with SSH | ||
|
||
if [[ -n "$ZSH_VERSION" ]]; then | ||
source "$(dirname "$0")/../shared.sh" | ||
else | ||
|