My build of nnn with minor changes
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

22 lines
408 B

  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 sudoedit)" -eq "0" ]; then
  12. sudoedit "$1"
  13. elif [ "$(is_cmd_exists sudo)" -eq "0" ]; then
  14. sudo "$EDITOR" "$1"
  15. elif [ "$(is_cmd_exists doas)" -eq "0" ]; then
  16. doas "$EDITOR" "$1"
  17. fi