Su : Add trysudo.

This commit is contained in:
Dmitry Voronin 2024-04-08 18:52:11 +03:00
parent 3ebfae082d
commit 57ab874668

View file

@ -15,7 +15,12 @@
else
''${*}
fi
}
# Run something as current user. If fails, try to run with sudo.
# Usage: trysudo <COMMAND>
function trysudo() {
''${*} || sudo ''${*}
}
function _complete_s() {
@ -23,6 +28,6 @@
}
complete -F _complete_s s
complete -F _autocomplete_nested sudo
complete -F _autocomplete_nested sudo trysudo
'';
}