Skip to content

Instantly share code, notes, and snippets.

@grgergo1
Created May 25, 2022 19:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save grgergo1/bb40a07d9e599481203763e20310aeea to your computer and use it in GitHub Desktop.
Save grgergo1/bb40a07d9e599481203763e20310aeea to your computer and use it in GitHub Desktop.
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