sistema_progs

Programas para customizar o meu entorno de traballo nos meus equipos persoais
Log | Files | Refs

suedit (318B)


      1 #!/usr/bin/env sh
      2 
      3 # Description: Edit file as superuser
      4 #
      5 # Shell: POSIX compliant
      6 # Author: Anna Arad
      7 
      8 EDITOR="${EDITOR:-vim}"
      9 
     10 if type sudo >/dev/null 2>&1; then
     11     sudo -E "$EDITOR" "$1"
     12 elif type sudoedit >/dev/null 2>&1; then
     13     sudoedit -E "$1"
     14 elif type doas >/dev/null 2>&1; then
     15     doas "$EDITOR" "$1"
     16 fi