My build of nnn with minor changes
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

123456789101112131415161718192021
  1. #!/usr/bin/env sh
  2. # Description: Edit file as superuser
  3. #
  4. # Shell: POSIX compliant
  5. # Author: Anna Arad
  6. EDITOR="${EDITOR:-vim}"
  7. is_cmd_exists () {
  8. which "$1" > /dev/null 2>&1
  9. echo $?
  10. }
  11. if [ "$(is_cmd_exists sudo)" -eq "0" ]; then
  12. sudo "$EDITOR" "$1"
  13. elif [ "$(is_cmd_exists sudoedit)" -eq "0" ]; then
  14. sudoedit "$1"
  15. elif [ "$(is_cmd_exists doas)" -eq "0" ]; then
  16. doas "$EDITOR" "$1"
  17. fi