[opensuse] BASH - Better way to get current driver from xorg.conf?
Listmates: I am trying to pull the current driver out of the xorg.conf and I have come up with a non-elegant way to do it but I'm concerned that I'm limiting it by only grabbing 2 additional lines on either side of "Identifier" to search for the Driver. Here is what I have: CURRENTDRIVER=$(grep -A2 -B2 Identifier[[:blank:]]*\"Device[[] /etc/X11/xorg.conf | grep Driver | awk --field-separator '"' '{ print $2 }') Is there a cleaner way to do this? I also found something interesting in /proc/bus/pci/devices, but I don't really know what it is telling me or whether this can be useful as well for finding the current graphics module. The fglrx line is (one line): 0128 1002791f 12 f000000c 0 f8100004 0 9001 f8000000 2 8000000 0 10000 0 100 100000 0 fglrx_pci Does anybody know what the fields are or a link where I can find out about /proc/bus/pci/devices? Thanks. -- David C. Rankin, J.D.,P.E. | openSoftware und SystemEntwicklung Rankin Law Firm, PLLC | Countdown for openSuSE 11.1 www.rankinlawfirm.com | http://counter.opensuse.org/11.1/small -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Saturday, 2008-11-22 at 09:20 -0600, David C. Rankin wrote:
I am trying to pull the current driver out of the xorg.conf and I have come up with a non-elegant way to do it but I'm concerned that I'm limiting it by only grabbing 2 additional lines on either side of "Identifier" to search for the Driver. Here is what I have:
CURRENTDRIVER=$(grep -A2 -B2 Identifier[[:blank:]]*\"Device[[] /etc/X11/xorg.conf | grep Driver | awk --field-separator '"' '{ print $2 }')
Is there a cleaner way to do this?
Yep, cgrep. See: cgrep -i -e "section.*\"Device" +w EndSection /etc/X11/xorg.conf \ | cgrep -i Driver yields: Driver "nv" Where cgrep is "context grep", obtainable here: http://www.bell-labs.com/project/wwexptools/cgrep/ http://www.bell-labs.com/cgi-user/wwexptools/gensnapshot?cgrep - -- Cheers, Carlos E. R. -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.9 (GNU/Linux) iEYEARECAAYFAkkoLFYACgkQtTMYHG2NR9WEyACgmRGn9gR4YZDmQlB+Rf6kIQok 7eEAn27Pq8Iz1rCEogf2gCwVLJKQJYw5 =oldO -----END PGP SIGNATURE----- -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
Hello, On Sat, 22 Nov 2008, David C. Rankin wrote:
I am trying to pull the current driver out of the xorg.conf and I have come up with a non-elegant way to do it but I'm concerned that I'm limiting it by only grabbing 2 additional lines on either side of "Identifier" to search for the Driver. Here is what I have:
CURRENTDRIVER=$(grep -A2 -B2 Identifier[[:blank:]]*\"Device[[] /etc/X11/xorg.conf | grep Driver | awk --field-separator '"' '{ print $2 }')
Is there a cleaner way to do this?
sed -n '/Section.*"Device"/,/EndSection/ { /Driver/s/.*"\([^"]*\)".*/\1/p; }' /etc/X11/xorg.conf -dnh -- Hey, what do you expect from a culture that *drives* on *parkways* and *parks* on *driveways*? -- Gallagher -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
participants (3)
-
Carlos E. R.
-
David C. Rankin
-
David Haller