Hello,

I am writing a script to determine if a serial mouse is connected to the local system. 
So far I have:

#!/bin/bash
SMOUSE=$(/bin/grep -i "serial" /etc/sysconfig/mouse)
if [ $SMOUSE = "" ]; then
   echo "There is not a serial mouse attached to this system."
else
   echo "A serial mouse is attached to this system."
fi

However, this script fails because there is a space or newline character or something 
in the grep output. I have considered taking another approach, such as looking for the 
word serial in the grep output, but I am unsure how to do this. If I add the following 
line:

echo $SMOUSE

the value that is returned on my system with a serial mouse is:

FULLNAME="Generic - 3 Button Mouse (serial)"

but I do not know how to determine if the string "serial" exists in the variable 
SMOUSE in terms of the 'if' statement.

Can anyone please suggest how I can make this script work.

Regards,
Matthew Richards


-- 
redhat-list mailing list
unsubscribe mailto:[EMAIL PROTECTED]
https://www.redhat.com/mailman/listinfo/redhat-list

Reply via email to