-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathbuscared.sh
More file actions
executable file
·61 lines (43 loc) · 877 Bytes
/
buscared.sh
File metadata and controls
executable file
·61 lines (43 loc) · 877 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/bin/bash
#
# Author: Ramon Antonio Parada <ramon@bigpress.net>
#
function buscared() {
local ifname=$1;
local ssid=$2;
SSID_AVAILABLE=$(/sbin/iwlist $ifname scan | grep "$ssid")
if [ -n "$SSID_AVAILABLE" ]; then
return 0
fi
return -1
}
#ssid[0]="valor_1"
#ssid[1]="valor_2"
#ssid[2]="valor_3"
#declare -p matriz
#for e in ${matriz[*]}
# do
# echo $e
# done
getifname() {
ifname=`/sbin/iwconfig 2> /dev/null | grep IEEE`
ifname=${ifname:0:4}
eval "$1=ifname"
#http://www.mcwalter.org/technology/shell/functions.html
}
testbuscared() {
#averiguamos nombre de la interfaz
getifname $ifname
ssid="R-wlan2"
echo "Interfaz: $ifname"
echo "ssid: $ssid"
buscared $ifname $ssid
RESULTADO=$?
echo "Retorno: $RESULTADO"
if [ "$RESULTADO" -eq 0 ]; then
echo "biennn"
else
echo "maaaaaaal"
fi
}
testbuscared