Last active
June 8, 2023 16:58
-
-
Save D1360-64RC14/f927e274e9867c6d22a3facd526c87d7 to your computer and use it in GitHub Desktop.
Run last command as sudo. Place the code in .bashrc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function sudoas { | |
local LAST_COMMAND=$(history 2 | head -n 1 | sed -E 's/ [[:digit:]]+ //') | |
echo "> sudo $LAST_COMMAND" | |
sudo $LAST_COMMAND | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment