X-Git-Url: https://git.ao2.it/xudo.git/blobdiff_plain/dcc7ed0a709b3c19916a2966e5f20de066a79b32..eaed0fbc27dcba6de96937f2443366ac879309c5:/xudo.sh diff --git a/xudo.sh b/xudo.sh index 5a2735a..7dc3b3f 100755 --- a/xudo.sh +++ b/xudo.sh @@ -18,15 +18,13 @@ # along with this program. If not, see . -# This is the equivalent of sux[1] but simpler and using sudo, -# since I don't have su installed on some of my systems. -# +# This is the equivalent of sux[1] but simpler and using sudo. # [1] http://fgouget.free.fr/sux/ set -e usage() { - echo "usage: $(basename $0) [OPTION]... "; + echo "usage: $(basename $0) [OPTION]... " echo "Execute a command as another user, with access to the X display" echo echo "List of OPTIONs:" @@ -72,9 +70,9 @@ id $USERNAME > /dev/null || { echo "Invalid user." 1>&2; exit 1; } [ "x$@" != "x" ] || { usage 1>&2; exit 1; } -# Authorize the user +# Authorize the user. xauth extract - $DISPLAY | sudo -u "$USERNAME" xauth merge - # Execute the command. -# NOTE: -i or -s have to be passed in order to open a shell +# NOTE: -i or -s can be passed in order to open a shell sudo DISPLAY="$DISPLAY" -u "$USERNAME" "$@"