Last active
January 26, 2022 14:11
-
-
Save anujonthemove/0c64aa257d112356e9b5aad7e9d9d162 to your computer and use it in GitHub Desktop.
Use this function to avoid adding linux commands to history.
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
# https://stackoverflow.com/questions/10307280/how-to-define-a-shell-script-with-variable-number-of-arguments | |
run(){ | |
my_cmd=$1; | |
# cmd_str='history -d $((HISTCMD)) && $my_cmd'; | |
shift | |
#echo $my_cmd "$@" | |
history -d $((HISTCMD-1)) && $my_cmd "$@" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment