I have a bash function defined in a global bashrc, which requires root privileges to work. How can I run it with sudo, e.g. sudo myfunction. By default it gives an error:
sudo: myfunction: command not found
feedback
|
|
Maybe you can do:
This should work and saves you from typing sudo on the commandline. | |||||
feedback
|
| |||
|
feedback
|
|
You can
Edit This works for direct subshells, but apparently Edit 2 However, it appears that
| |||||||||||
feedback
|
|
I would execute a new shell by having sudo execute the shell itself, then the function will run with root privileges. For example something like:
You could even then go to make an alias for the | |||
|
feedback
|
then run your command | |||||
feedback
|