Le 22/06/2014 16:33, Cliff McDiarmid a écrit : > Hi > > Can someone point me in the right direction here please? > > I'm trying to write a simple script to remove one wireless module(if it is > present)and install another. If the module is not present then I need the > existing module(iwlwifi) deleted. > > I can't get this to work however: > > #! /bin/bash > > if [ -e $r8712u ]; then > rmmod r8712u; > insmod /lib/modules/3.13.3/kernel/drivers/net/wireless/iwlwifi/iwlwifi.ko; > insmod > /lib/modules/3.13.3/kernel/drivers/net/wireless/iwlwifi/dvm/iwldvm.ko; > echo "Module r8712u is removed and iwlwifi installed." > else > rmmod iwldvm; > rmmod iwlwifi; > echo "Module iwlwifi is removed." > fi > > thanks > > Cliff > > Hi Cliff,
First, semicolons at the end of a line are not needed. They are only needed as a separator between commands on the same line. OTOH, they do not hurt in this case; I think. I think there are several points which may be causing trouble: First, "if [ -e $r8712u ]" tests whether a file exist, not whether a module is loaded. Second, $r8712u is a variable. It should contain the name of the file whose presence is to be tested. try: echo $r8712u and you'll see what is in there Third, "rmmod/insmod" do not delete/install modules. They unload/load the modules from/into the kernel. If you want to prevent the kernel to load a module, the best is to use "blacklist". You might want to have a look at page 7.4 (Device and Module Handling on an LFS System) in the LFS-7.5 book. I think the page is 7.3 and the title is different on LFS-SVN. Regards Pierre -- http://lists.linuxfromscratch.org/listinfo/blfs-support FAQ: http://www.linuxfromscratch.org/blfs/faq.html Unsubscribe: See the above information page
