bin sh while getopts sPn option do case option in if echo OPTARG cut -

 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
#!/bin/sh
while getopts sPn: option
do
case $option in
n)
if [ `echo "$OPTARG" | cut -d '.' -f 3` = 13 ]
then ssh user_nmap@10.10.113.1 $OPTARG; #RUN
elif [ `echo "$OPTARG" | cut -d '.' -f 3` = 3 ] && [ `echo "$OPTARG" | cut -d '.' -f 4 | cut -d '/' -f 1` = 129 ]
then ssh user_nmap@10.10.103.1 $OPTARG; #Alex k3
elif [ `echo "$OPTARG" | cut -d '.' -f 3` = 3 ] && [ `echo "$OPTARG" | cut -d '.' -f 4 | cut -d '/' -f 1` = 1 ]
then ssh user_nmap@192.168.3.1 $OPTARG; #Alex k10
elif [ `echo "$OPTARG" | cut -d '.' -f 3` = 2 ]
then ssh user_nmap@10.10.103.1 $OPTARG; #Alex
elif [ `echo "$OPTARG" | cut -d '.' -f 3` = 11 ]
then ssh user_nmap@192.168.11.1 $OPTARG; #SB
elif [ `echo "$OPTARG" | cut -d '.' -f 3` = 4 ]
then ssh user_nmap@192.168.4.1 $OPTARG; #KZN-Kalinina
elif [ `echo "$OPTARG" | cut -d '.' -f 3` = 15 ]
then ssh user_nmap@192.168.15.1 $OPTARG; #KZN-Suvar
fi
esac
done