Hi, all
If I run a command starts with '_' , then It automatically convert into 'sudo '. For example:
_vi file #=> sudo vi file
this is the best way to run sudo command. alias can do it, but I want all commands support this form, make every command as an alias is impossible. and preexec hook function can't do this.
substitution the command and run the modified command.
Guten,
thanks.
You should maybe choose an other character because the underscore is already used by the completion system.
You can see it by typing _ then [tab] [tab]
which _ls will show you the function
ls - [tab] will use this function to show you the options of ls.
yes, I found _func is a completion function. if you are actually going to implement it. any character will be fine, then maybe hypen '-' is another choice.