-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwhohas
More file actions
41 lines (38 loc) · 694 Bytes
/
Copy pathwhohas
File metadata and controls
41 lines (38 loc) · 694 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
#!/bin/bash
A=({2..26})
E=({27..51})
F=({52..76})
ET=({77..100})
while getopts ':f:p:' OPTION; do
case "$OPTION" in
f)
classroom="${OPTARG^^}[@]"
;;
p)
prog="$OPTARG"
;;
:)
echo "Missing argument for $OPTARG" >&2
exit 2
;;
?)
echo "Invalid flag." >&2
exit 2
;;
esac
done
if [[ "$prog" ]] && [[ "$classroom" ]]; then
for i in "${!classroom}"; do
pc=159.59.9.$i
if ping -c 1 $pc >/dev/null; then
echo "Checking if '${prog}' is in $pc."
ssh root@$pc "which ${prog}"
echo
else
echo "$pc is off."
fi
done
else
echo "Missing some argument in the script." >&2
exit 2
fi