Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Core alias "sudo" for alias expansion #15

Closed
arcticicestudio opened this issue Jan 27, 2017 · 0 comments
Closed

Core alias "sudo" for alias expansion #15

arcticicestudio opened this issue Jan 27, 2017 · 0 comments

Comments

@arcticicestudio
Copy link
Owner

arcticicestudio commented Jan 27, 2017

Add a core alias sudo to fix alias expansion when running a user alias via sudo:
alias sudo='sudo '

Bash only checks the first word of a command for an alias, any words after that are not checked.
That means in a command like sudo pacman, only the first word (sudo) is checked by bash for an alias, pacman is ignored. This can be changed by adding a space to the end of the alias value so bash checks the next word after the alias.

Snippet of the official bash manual:

The first word of each simple command, if unquoted, is checked to see if it has an alias. If so, that word is replaced by the text of the alias.
[...]
If the last character of the alias value is a blank, then the next command word following the alias is also checked for alias expansion

More information and this alias can also be found in the Arch Linux Wiki for sudo.

@arcticicestudio arcticicestudio self-assigned this Jan 27, 2017
@arcticicestudio arcticicestudio changed the title Core alias for "sudo" Core alias "sudo" for alias expansion Jan 27, 2017
@arcticicestudio arcticicestudio added this to the 0.1.0 milestone Jul 15, 2017
@arcticicestudio arcticicestudio removed their assignment Sep 23, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant