#5 modify command and run it.

open
nobody
None
5
2013-01-25
2011-06-12
Guten
No

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.

Discussion

  • pir

    pir - 2011-07-22

    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.

     
  • Guten

    Guten - 2011-07-24

    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.

     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks