Skip to content

Instantly share code, notes, and snippets.

@grgergo1
Created May 25, 2022 19:50
sudoedit alternative for OpenDoas
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