Posted by: Anonymous Coward
on June 22, 2006 03:17 AM
I've long had a similar script, but the graphics regularly choked it, even with chvt. I hope this is the long hoped for relief. But what a pipe to get the ID! How about:
My preference is not to use any external tool, just the Shell:
lspci | while IFS='<nobr> <wbr></nobr>:' read dir id type x; do [ $type = VGA ] && print $dir/$id && break; done
This doesn't do the 0000:, which is not needed on SuSE.
Now that would probably best be done in Perl! Then you could also read in the data into a variable rather than call 5 external proggies to handle the temp file (of which one rm is redundant).
Pipemania
Posted by: Anonymous Coward on June 22, 2006 03:17 AMlspci | awk '/VGA/ { print $1 }' | sed -e 's@0000:@@' -e 's@:@/@'
Probably AWK can also do the formatting, but I dug out my old sed know how:
lspci | sed -e '/VGA/!d' -e 's/<nobr> <wbr></nobr>.*//' -e 's@0000:@@' -e 's@:@/@' -eq
My preference is not to use any external tool, just the Shell:
lspci | while IFS='<nobr> <wbr></nobr>:' read dir id type x; do [ $type = VGA ] && print $dir/$id && break; done
This doesn't do the 0000:, which is not needed on SuSE.
Now that would probably best be done in Perl! Then you could also read in the data into a variable rather than call 5 external proggies to handle the temp file (of which one rm is redundant).
#