Hi.
I'm currently learning myself bash scripting.
I've run into a problem that I can see no easy solution to.
This is the script.
I've commented out the lines that are not working.
Code:
#!/bin/bash
flag=1
count=$(iwlist scan 2>/dev/null | grep Cell | wc -l)
(( count++ ))
while [ $flag -lt $count ]; do
cell=$(iwlist scan 2>/dev/null | grep "Cell 0$flag")
#essid=$(iwlist scan 2>/dev/null | grep ESSID ) #WHAT TO USE???
echo -n "$cell --- "
#echo "$essid"
echo ""
(( flag++ ))
done
exit 0
What I like to do is make the "ESSID" line appear behind the "Cell" line, but there are no uniqe way to identify this to grep.
Is there any other tool that can do this or just exract the collected info from the $essid variable?
Any advise to simplify my script even further is appeciated.
PS: I know that your favourite language probably beats shellscripting, but I'm not trying to learn that language right now.