Sucess with dual monitors

Erik Christiansen erik at dd.nec.com.au
Wed Jun 21 06:41:33 UTC 2006


On Tue, Jun 20, 2006 at 10:52:50PM -0700, Matthew Kuiken wrote:
> if [ $# -lt 1 ]; then
> 	echo
> 	echo "call with 1 for single monitor, 2 for multimonitor."
> 	exit -1
> fi 
> 
> if [ $1 = "2" ]; then
> 	sudo cp /etc/X11/xorg.conf.multimonitor /etc/X11/xorg.conf
> 	exit 2
> elif [ $1 = "1" ]; then
> 	sudo cp /etc/X11/xorg.conf.singlemonitor /etc/X11/xorg.conf
> 	exit 1
> else
> 	echo "call with 1 for single monitor, 2 for multimonitor."
> 	exit -2
> fi

Matthew,

   That's great for a first attempt. :-)

One small convenience hint:

msg=""call with 1 for single monitor, 2 for multimonitor."

Then in two places:

echo $msg

This avoids the subsequent maintenance hassle of changing one, but
forgetting the other.

I don't know whether the following offers anything that would appeal:

cmd=${0##*/}                              # Command's basename
msg="\n\tUsage: $cmd [1|2]\n\t\t1 = single monitor\n\t\t2 = multimonitor"

That's all a matter of taste, except I find that separation by a blank
line has a highlighting effect, and several lines of output jangle my
optic nerves sufficiently to actually stimulate reading. (Your eyesight
and attention may be better than mine. :-)

Happy hacking,

Erik




More information about the ubuntu-users mailing list