> [ -n $DISPLAY ] && {
>     [ -f /etc/profile.d/color_ls.sh ] && source /etc/profile.d/color_ls.sh
>      export XAUTHORITY=$HOME/.Xauthority
> }
> 
> If you use ssh, $DISPLAY will be set. Then the rest won't be executed.
> 
> Or am I wrong?

Well, with -n the {} is supposed to be executed if the string is NOT
null.
In fact, the test is bad:
[root@brian MetaSu]# unset TOTO
[root@brian MetaSu]# [ -n $TOTO ] && echo toto
toto
[root@brian MetaSu]# [ -n "$TOTO" ] && echo toto
[root@brian MetaSu]# 


So anyway, [ -n $DISPLAY ] is true whatever DISPLAY is defined or not
(all $VAR should be in "" for the case of empty strings).
I don't know what the correct thing to do is, maybe :
[ -n "$DISPLAY" ] && {
    [ -f /etc/profile.d/color_ls.sh ] && source /etc/profile.d/color_ls.sh
    [ -n "$XAUTHORITY" ] || export XAUTHORITY=$HOME/.Xauthority
}

-- 
Xavier

Reply via email to