i810: missing modes when unpluging CRT
Dan Nicholson
dbn.lists at gmail.com
Mon Feb 5 09:55:03 PST 2007
On 2/5/07, Ross Burton <ross at burtonini.com> wrote:
>
> I've nearly got the modesettings/xrandr1.2 foo all working as I want,
> but I'm having a problem whilst writing a small script to automatically
> adjust. The magic part of the script:
>
> xrandr -q | grep -q "VGA connected"
> if [ $? ]; then
> xrandr --output 0x5d --off --output 0x5c --mode 0x6c
> else
> xrandr --output 0x5c --off --output 0x5d --mode 0x60
> fi
I have no idea about the modesetting part, but that shell logic won't
work. The "if [ ... ]" is just checking whether the $? string is empty
or not. It will always have a character, so that test is always true.
This would work (except, you don't test success of xrandr itself, only
the grep):
if xrandr -q | grep -q "VGA connected"; then
true case
else
failure case
fi
since the shell knows how to handle the success of the command on its own.
If you really want to test whether $? is 0 or 1, use numeric expansion (in bash)
if (( $? )); then
failure case
else
true case
fi
--
Dan
More information about the xorg
mailing list