Created
February 1, 2021 22:45
-
-
Save arbal/96cd4a675da9173d4889907aa71fbdcf to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| #!/usr/bin/env bash | |
| set -euo pipefail | |
| # histdump.sh | |
| # | |
| HOME=${HOME:-'/root'} | |
| arg1=${1:-} | |
| [[ $arg1 = "bash" ]] && skip_zsh="true" | |
| [[ $arg1 = "zsh" ]] && skip_bash="true" | |
| bash_history="${HOME}/.bash_history" | |
| zsh_history="${HOME}/.zsh_history" | |
| if [[ -z ${skip_bash:-} && -f "$bash_history" ]]; then | |
| # echo "##### cat $bash_history #########################################################################" | |
| cat "$bash_history" | |
| fi | |
| if [[ -z ${skip_zsh:-} && -f "$zsh_history" ]]; then | |
| # shellcheck disable=SC2028 | |
| # echo "##### awk -F\; 'NF!=1{printf(\"\n%s\",\$NF)}NF==1{printf(\"n %s \",\$1)}' \"$zsh_history\" #####" | |
| awk -F\; 'NF!=1{printf("\n%s",$NF)}NF==1{printf("n %s ",$1)}' "$zsh_history" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment