3 edited body
source | link

Root shouldn't need aliases. If you want something private, then don't start changing things in other user's accounts (root's in this case).

Just write ksession as a shell script and use sudo in the script to when needed. Put the script in a private directory, for example $HOME/bin, and make sure that this directory is part of your $PATH and that the script is executable.

Alternatively, write it as a shell function and put it in your ~/.bashrc file. The function may use sudo when needed.

Alternatively, write it as an alias and put it in your ~/.bashrc file. The functionalias may use sudo when needed.


Your sudo source ... command does not work since source inis a bash built-in command and sudo expects an external command.

Even if it had worked, the alias would not have been activated in the calling shell as the command that sudo invokes is running in its own sub-shell.

Root shouldn't need aliases. If you want something private, then don't start changing things in other user's accounts (root's in this case).

Just write ksession as a shell script and use sudo in the script to when needed. Put the script in a private directory, for example $HOME/bin, and make sure that this directory is part of your $PATH and that the script is executable.

Alternatively, write it as a shell function and put it in your ~/.bashrc file. The function may use sudo when needed.

Alternatively, write it as an and put it in your ~/.bashrc file. The function may use sudo when needed.


Your sudo source ... command does not work since source in a bash built-in command and sudo expects an external command.

Even if it had worked, the alias would not have been activated in the calling shell as the command that sudo invokes is running in its own sub-shell.

Root shouldn't need aliases. If you want something private, then don't start changing things in other user's accounts (root's in this case).

Just write ksession as a shell script and use sudo in the script to when needed. Put the script in a private directory, for example $HOME/bin, and make sure that this directory is part of your $PATH and that the script is executable.

Alternatively, write it as a shell function and put it in your ~/.bashrc file. The function may use sudo when needed.

Alternatively, write it as an alias and put it in your ~/.bashrc file. The alias may use sudo when needed.


Your sudo source ... command does not work since source is a bash built-in command and sudo expects an external command.

Even if it had worked, the alias would not have been activated in the calling shell as the command that sudo invokes is running in its own sub-shell.

2 added 110 characters in body
source | link

Root shouldn't need aliases. If you want something private, then don't start changing things in other user's accounts (root's in this case).

Just write ksession as a shell script and use sudo in the script to when needed. Put the script in a private directory, for example $HOME/bin, and make sure that this directory is part of your $PATH and that the script is executable.

Alternatively, write it as a shell function and put it in your ~/.bashrc file. The function may use sudo when needed.

Alternatively, write it as an and put it in your ~/.bashrc file. The function may use sudo when needed.


Your sudo source ... command does not work since source in a bash built-in command and sudo expects an external command.

Even if it had worked, the alias would not have been activated in the calling shell as the command that sudo invokes is running in its own sub-shell.

Root shouldn't need aliases. If you want something private, then don't start changing things in other user's accounts (root's in this case).

Just write ksession as a shell script and use sudo in the script to when needed. Put the script in a private directory, for example $HOME/bin, and make sure that this directory is part of your $PATH and that the script is executable.

Alternatively, write it as a shell function and put it in your ~/.bashrc file. The function may use sudo when needed.


Your sudo source ... command does not work since source in a bash built-in command and sudo expects an external command.

Even if it had worked, the alias would not have been activated in the calling shell as the command that sudo invokes is running in its own sub-shell.

Root shouldn't need aliases. If you want something private, then don't start changing things in other user's accounts (root's in this case).

Just write ksession as a shell script and use sudo in the script to when needed. Put the script in a private directory, for example $HOME/bin, and make sure that this directory is part of your $PATH and that the script is executable.

Alternatively, write it as a shell function and put it in your ~/.bashrc file. The function may use sudo when needed.

Alternatively, write it as an and put it in your ~/.bashrc file. The function may use sudo when needed.


Your sudo source ... command does not work since source in a bash built-in command and sudo expects an external command.

Even if it had worked, the alias would not have been activated in the calling shell as the command that sudo invokes is running in its own sub-shell.

1
source | link

Root shouldn't need aliases. If you want something private, then don't start changing things in other user's accounts (root's in this case).

Just write ksession as a shell script and use sudo in the script to when needed. Put the script in a private directory, for example $HOME/bin, and make sure that this directory is part of your $PATH and that the script is executable.

Alternatively, write it as a shell function and put it in your ~/.bashrc file. The function may use sudo when needed.


Your sudo source ... command does not work since source in a bash built-in command and sudo expects an external command.

Even if it had worked, the alias would not have been activated in the calling shell as the command that sudo invokes is running in its own sub-shell.