Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SHELL

sudo !! alias

# You can use the 'history' built-in to do the expansion:
alias please='sudo $(history -p !!)'

# If the command is more than a simple command (e.g. it contains redirections or pipes), you need to invoke a shell under sudo:
alias please='sudo "$BASH" -c "$(history -p !!)"'
Source by unix.stackexchange.com #
 
PREVIOUS NEXT
Tagged: #sudo #alias
ADD COMMENT
Topic
Name
9+8 =