Skip to content

Instantly share code, notes, and snippets.

@anujonthemove
Last active January 26, 2022 14:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anujonthemove/0c64aa257d112356e9b5aad7e9d9d162 to your computer and use it in GitHub Desktop.
Save anujonthemove/0c64aa257d112356e9b5aad7e9d9d162 to your computer and use it in GitHub Desktop.
Use this function to avoid adding linux commands to history.
# 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