Checking if Module Loaded with Bash
From Deja.com (again)
teknokr@t wrote in message
news:36E8D2E0.619B8F86@mindless.com...
I am writing a shell script that needs to check two things;
1) if a particular module is loaded
2) if a particular device is mounted
can anyone help me here - is there a way to use modprobe
to do this?
thanks
From: Mike Noonan (mpn@euronet.nl)
Subject: Re: help with script
Newsgroups: comp.os.linux, alt.linux
View this article only
Date: 1999/03/12
Try This...
#!/bin/bash
# Check Whether a Module has been loaded or not
# Syntax: Listmod.sh
typeset -i Result
/sbin/lsmod | grep "$1 " /dev/null
let Result=$?
if [ i$Result = 0 ]
then
echo Module $1 is loaded
else
echo Module $1 is not loaded
fi
exit $Result
Use the same idea for mounted systems , only use the mount command
>>
Leonard Chan's Homepage
>>
Scribble Web
>> Checking if Module Loaded with Bash