Created
October 13, 2024 20:50
-
-
Save rhighs/b5d004c78ee4a7b530c30c99fffd045c to your computer and use it in GitHub Desktop.
I forget :/
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
| remind () | |
| { | |
| if [ $1="-h" ] || [ $1="--help" ]; then | |
| echo "usage: remind <command_prefix>" | |
| return 0 | |
| fi | |
| if [ -z "$1" ]; then | |
| echo "usage: remind <command_prefix>">&2 | |
| return 1 | |
| fi | |
| local cmd=$(history | grep "$1" | grep -v "remind" | tail -n 1 | sed 's/^[ ]*[0-9]*[ ]*//') | |
| if [ -z "$cmd" ]; then | |
| echo "no matching command">&2 | |
| return 1 | |
| fi | |
| echo "$cmd" | |
| eval "$cmd" | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment