Guest User

Untitled

a guest
Feb 24th, 2018
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. The other solutions I've seen here so far are based on some system definitions, but it's in fact possible to have sudo use the current PATH (with the env command) and/or the rest of the environment (with the -E option) just by invoking it right:
  2.  
  3. ```
  4. sudo -E env "PATH=$PATH" <command> [arguments]
  5. ```
  6.  
  7. In fact, one can make an alias out of it:
  8.  
  9. ```
  10. alias mysudo='sudo -E env "PATH=$PATH"'
  11. ```
  12.  
  13. (It's also possible to name the alias itself sudo, replacing the original sudo.)
Add Comment
Please, Sign In to add comment