Sent: Sunday, June 22, 2014 at 5:27 PM
From: "Pierre Labastie" <[email protected]>
To: "BLFS Support List" <[email protected]>
Subject: Re: [blfs-support] Help needed with simple script
Le 22/06/2014 17:36, Cliff McDiarmid a écrit :
>
>
>
>
>>>
>>> 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

>> 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.

>That's why I told you to examine the content of this variable, but I was not
>clear, sorry. I meant that you type:
>echo $r8712u
>at the console prompt, and that you see what it outputs.

Gives zero output

>If I understand what you want to do, I think the test is:
>if lsmod | grep -q r8712u ; then ...
>but please do not use this command without understanding what it does ("man
>bash is your friend". Read about "exit status" and the "if" command)

You're right, that is the command, and I've used it before to write a monitor 
switching script, clearly forgot, I'm not a programmer(how did you guess).

Listing the current running modules and then searching silently with grep to 
find 'r8712u'.

The script now runs perfectly, many thanks

Cliff

-- 
http://lists.linuxfromscratch.org/listinfo/blfs-support
FAQ: http://www.linuxfromscratch.org/blfs/faq.html
Unsubscribe: See the above information page

Reply via email to