[ltp] *60 with ipw3945 (gentoo maybe interesting to other distros)

Tino Keitel linux-thinkpad@linux-thinkpad.org
Mon, 18 Sep 2006 11:43:54 +0200


On Sun, Sep 17, 2006 at 12:44:43 +0200, Florian Manschwetus wrote:
> I managed now the ipw3945d problem
> following steps to solve

[...]

> 
> 5. create script /usr/local/sbin/modulhelper, with this code
> #!/bin/bash
> if [ "${1}" == "" ]; then
>     echo "modulhelper"
>     echo ""
>     echo "This little script to check if a module is loaded or not"
>     echo ""
>     exit 0
> fi
> LOADED_MODULES=`lsmod | grep -v "^Module" | cut -d " " -f 1`
> for i in ${LOADED_MODULES}; do
> 	if [ ${i} == ${1} ]; then
> 		exit 0
> 	fi
> done
> exit -1

Why not just do:

lsmod |
cut -d' ' -f 1 |
tail -n +2 |
grep "$1" >/dev/null

return $?

Regards,
Tino