1 2 3 4 5 6 7 8 9
#!/bin/sh FILE=$(readlink -f "$1") if [ $(id -u) -eq 0 ]; then exec sudo -u "$SUDO_USER" emacsclient -nw "/sudo::$FILE" else exec emacsclient -nw "$FILE" fi