Su : Sudo now runc cmd as a normal user if su binary is not available.

This commit is contained in:
Dmitry Voronin 2024-03-13 02:42:21 +00:00
parent b0953217e8
commit 859121ff85

View file

@ -5,10 +5,15 @@ function s() {
su - ${1}
}
# Run something as root.
# Run something as root. Runs command as a current user if su is not available.
# Usage: sudo <COMMAND>
function sudo() {
if command -v su; then
su -c "$(echo ${*} | tr '\n' ' ')"
else
${*}
fi
}
function _complete_s() {