Added git pretty alias.
[profile.git] / .profile.d / xauth.bashrc
1 # Merge xauth cookies into home stash.
2 if [ -n "$XAUTHORITY" ]; then
3   if [ -r "$XAUTHORITY" ]; then
4     # If we are root the old file may have been chowned.
5     [ -n "$SUDO_UID" -a -O "$XAUTHORITY" ] && chown "$SUDO_UID" "$XAUTHORITY"
6     [ -n "$SUDO_GID" -a -G "$XAUTHORITY" ] && chgrp "$SUDO_GID" "$XAUTHORITY"
7
8     # Merge and unset.
9     exec 3<&0 < "$XAUTHORITY"
10     unset XAUTHORITY
11     xauth merge - 2>/dev/null
12     exec <&3 3<&-
13   else
14     # We can't read the file so just unset.
15     unset XAUTHORITY
16   fi
17 fi