1
1
mirror of https://github.com/jarun/nnn.git synced 2024-09-17 15:57:17 +03:00
nnn/plugins/suedit

17 lines
318 B
Plaintext
Raw Normal View History

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