Skip to content

Instantly share code, notes, and snippets.

@ryanartecona ryanartecona/confirm
Created Dec 14, 2012

What would you like to do?
Add a sanity confirmation to sensitive commands
# with help from
# and
function confirm( ) {
#confirm with the user
read -r -p "$* [y/n]: " response
case "$response" in
#if yes, then execute the passed parameters
#Otherwise exit...
echo "cancelled."
# make sure it works properly
alias ls='confirm ls'
# protect my terminal from myself
alias kill='confirm kill'
alias pkill='confirm pkill'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.