2019-10-14 01:06:11 +00:00
|
|
|
#!/usr/bin/env sh
|
|
|
|
|
|
|
|
# Description: Edit file as superuser
|
|
|
|
#
|
|
|
|
# Shell: POSIX compliant
|
|
|
|
# Author: Anna Arad
|
|
|
|
|
2020-11-28 04:33:05 +00:00
|
|
|
EDITOR="${EDITOR:-vim}"
|
2019-10-14 01:06:11 +00:00
|
|
|
|
2021-05-14 12:03:28 +00:00
|
|
|
if type sudo >/dev/null 2>&1; then
|
2021-07-17 16:11:19 +00:00
|
|
|
sudo -E "$EDITOR" "$1"
|
2021-05-14 12:03:28 +00:00
|
|
|
elif type sudoedit >/dev/null 2>&1; then
|
2021-07-17 16:11:19 +00:00
|
|
|
sudoedit -E "$1"
|
2021-05-14 12:03:28 +00:00
|
|
|
elif type doas >/dev/null 2>&1; then
|
2019-10-14 01:06:11 +00:00
|
|
|
doas "$EDITOR" "$1"
|
|
|
|
fi
|