Created
May 25, 2022 19:50
-
-
Save grgergo1/bb40a07d9e599481203763e20310aeea to your computer and use it in GitHub Desktop.
sudoedit alternative for OpenDoas
This file contains 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
if [[ -z $1 ]] | |
then | |
echo "Usage: $0 [FILE]" | |
exit 1 | |
fi | |
rand=$RANDOM | |
file=$(basename $1) | |
doas cp $1 /tmp/$file.$rand 2> /dev/null | |
doas touch /tmp/$file.$rand | |
doas chown $(whoami) /tmp/$file.$rand 2> /dev/null | |
$EDITOR /tmp/$file.$rand | |
doas cp /tmp/$file.$rand $1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment