0

In the following script I need to know if the configuration files is for a 2.4 or a 5.2 radio. This info is found in the filename so I'm trying to use grep -l 2.4 to find out if it's a 2.4 config file or not. If it's not the script sould go to the else clause but it's still echoing "5.2" file even when the file used as the command line argument is a 2.4 file.

garrett@bedroom ~$ ./testScript.sh system-2.4-AP.cfg
M2
M5
5.2 file
system-2.4-AP.cfg
empty-ssid
NanoBridge

Here's the script

FILE=${1}
SSID=$(grep -o empty-ssid ${FILE})
GATEWAY=$(grep -o 192.168.1.1 ${FILE})
#IP=$(grep -o ###.###.###.### ${FILE})
DEVICE="NanoBridge"

M2=" M2"
M5=" M5"

echo ${M2}
echo ${M5}

if [ $(ls ${FILE} | grep -l *2.4*) ]; then #{
        DEVICE=${DEVICE}${M2}
        echo "2.4 file"
else #} {
        #DEVICE="${DEVICE}${M5}
        echo "5.2 file"
fi #}

echo ${FILE}
echo ${SSID}
#echo ${FILE:${#FILE} - 2}
echo ${DEVICE}
#END#

Any ideas?

1
Contributor
1
Reply
11
Views
4 Years
Discussion Span
Last Post by lewashby
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.