Hendrik Sattler schrieb am Donnerstag, 25. November 2004 um 23:48:29 +0100: > This one? Yes.
> +# Building the devicelist: > +# Kernel 2.4 running' > +if [ `dmesg | grep -c "Elite 3D"` -ne 0 ]; then > + afb_devs=`/bin/dmesg | /bin/egrep -i "Elite 3D" | /bin/sed 's/\:.*//'` > +fi > + > +# Kernel 2.6: > +if [ `/bin/dmesg | /bin/grep -c "ffb: AFB"` -gt 0 ]; then > + afb_devs=`/bin/cat -s /proc/fb | /bin/egrep -i "Elite 3D" | /bin/sed > 's/\ .*//' | /bin/sed 's/^/fb/'` > +fi > > First thing is useless use of cat and why egrep instead of grep? With egrep, your right. I don't know why, but see this: [EMAIL PROTECTED]:~# grep -i "Elite 3D" /proc/fb [EMAIL PROTECTED]:~# egrep -i "Elite 3D" /proc/fb [EMAIL PROTECTED]:~# cat /proc/fb | egrep -i "Elite 3D" [EMAIL PROTECTED]:~# cat -s /proc/fb | egrep -i "Elite 3D" 0 Elite 3D [EMAIL PROTECTED]:~# cat -s /proc/fb | grep -i "Elite 3D" 0 Elite 3D I need to use "cat -s" otherwise it doesn't work > You can also remove one sed (untested): > afb_devs=fb`/bin/grep -i "Elite 3D" /proc/fb | /bin/sed 's/\ .*//'` no I cannot because there might be more than one line in /proc/fb ie: --- 0 Elite 3D 1 Elite 3D --- and both devices should be inizialized. but yes I could do it with only one sed: /bin/sed 's/\([0-9]\)\ .*/fb\1/' > Those are two programs less to execute... > And maybe put case for 2.4.* and 2.6.* so not both have to be executed. This > way, you can get rid of both if statements. -- Jörg Friedrich There are only 10 types of people: Those who understand binary and those who don't.