File: getifstatus

package info (click to toggle)
raccess4vbox3 0.2.8.2
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 2,008 kB
  • ctags: 34
  • sloc: tcl: 703; sh: 155; makefile: 125
file content (37 lines) | stat: -rwxr-xr-x 577 bytes parent folder | download | duplicates (4)
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
#!/bin/sh

IF=ippp0
IFTEXT="ippp & 0"

ifconfig=/sbin/ifconfig
isdnctrl=/usr/sbin/isdnctrl
grep=/bin/grep
cut=/usr/bin/cut
awk=/usr/bin/awk

STAT=`$isdnctrl status $IF | $cut -d ' ' -f 4`
if [ "$STAT" != "connected" ]; then
	cat << EOT
$IFTEXT & connected
EOT

	IP=`$ifconfig $IF | $grep addr: | $cut -d : -f 2 | $cut -d ' ' -f 1`
	if [ -n "$IP" ]; then
		IPN=""
		for i in `echo $IP | $awk 'gsub(//," ")'`; do
			if [ "$i" = "." ]; then
				i=dot
			fi
			IPN="$IPN$i & "
		done
		cat << EOT
ip is & $IPN stop
EOT
	fi
else
	cat << EOT
$IFTEXT & not & connected
EOT
fi

exit 0