File: ip-eth1

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

IF=eth1

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

if [ -z "$IF" ]; then
	cat << EOT >&2
Usage: $0 <interface>

EOT
	exit 1
fi

IP=`$ifconfig $IF | $grep "inet 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
	IPN=${IPN:3}
	cat << EOT
$IPN
EOT
fi

exit 0