bash - How to prevent git from quitting when I use TAB completion? -


i want git require confirmation resetting, updated william pursell's suggestion written here this:

git() { set -e -u if [ $# -ge 2 ];     if [ "x$1" = "xreset" -a "x$2" = "x--hard" ];         echo "are sure? (type 'yes')"         read resp || return $?         if [ "x$resp" = "xyes" ];             echo "resetting"         else                             echo "not resetting"             return 0         fi     fi fi command git "$@" || : } 

with won't quit console if mistype command, still quits if try use tab completion. there way prevent this?

remove line set -e -u. settings global shell session, not local function, , conflict shell completion functions not immune undefined variables (set -u). , since function written, need neither set -e nor set -u.


Comments

Popular posts from this blog

networking - Vagrant-provisioned VirtualBox VM is not reachable from Ubuntu host -

c# - ASP.NET Core - There is already an object named 'AspNetRoles' in the database -

ruby on rails - ArgumentError: Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true -