I'm sorry, I left out a critical component of the script. Here's the correct version:
Code:
#!/bin/bash
if [ "$(xrandr -q | egrep 'VGA.* connected')" ]; then
xrandr --output LVDS --off --output VGA --auto
fi
The "$(...)" that I added in the version above actually causes the script to execute "xrandr -q | egrep 'VGA.* connected'" and then the "if" statement can evaluate whether that command line returned any output. The earlier incorrect version was just testing to see if the string "xrandr -q | egrep 'VGA.* connected'" was non-null, which of course it always was.
Anyway, sorry for the error. Hope it didn't cause you too much consternation for your talk.
Bookmarks