mirror of
https://github.com/jarun/nnn.git
synced 2024-09-11 13:06:14 +03:00
17 lines
318 B
Bash
Executable File
17 lines
318 B
Bash
Executable File
#!/usr/bin/env sh
|
|
|
|
# Description: Edit file as superuser
|
|
#
|
|
# Shell: POSIX compliant
|
|
# Author: Anna Arad
|
|
|
|
EDITOR="${EDITOR:-vim}"
|
|
|
|
if type sudo >/dev/null 2>&1; then
|
|
sudo -E "$EDITOR" "$1"
|
|
elif type sudoedit >/dev/null 2>&1; then
|
|
sudoedit -E "$1"
|
|
elif type doas >/dev/null 2>&1; then
|
|
doas "$EDITOR" "$1"
|
|
fi
|