[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Switching X configs
Steve Reindl said:
> Just had one of those rare brain dumps. How about a shell script to
> swap config files before starting X, depending on which one I want to
> use
Like this? (I'm using -xf86config in the example, but you could just
as easily swap config files with "ln -sf" or something.)
#### Begin shell script ####
#!/bin/sh
clear
cat << END
Which configuration would you like?
1) Standard configuration (default)
2) Alternate configuration
END
printf 'Your choice: '
read CHOICE
case "$CHOICE" in
""|1)
exec startx
;;
2)
exec startx -- -xf86config /etc/X11/XF86Config-alt
;;
*)
echo 'Invalid selection!'
exit 1
;;
esac
#### END ####
Of course, if you wanted to be really silly, and you happen to have
dialog installed, you could do something like this:
#### Begin shell script ####
#!/bin/sh
dialog --title 'X startup' \
--defaultno \
--yesno 'Use alternate configuration file?' 10 30
STATUS=$?
if [ "$STATUS" -eq 0 ] ; then
exec startx -- -xf86config /etc/X11/XF86Config-alt
elif [ "$STATUS" -eq 1 ] ; then
exec startx
else
# User aborted by pressing ESC.
exit 1
fi
#### END ####
(And just think, all of that without one line of Perl. ;)
Steve
--
steve@silug.org | Southern Illinois Linux Users Group
(618)398-7320 | See web site for meeting details.
Steven Pritchard | http://www.silug.org/
-
To unsubscribe, send email to majordomo@silug.org with
"unsubscribe silug-discuss" in the body.