~ubuntu-branches/debian/wheezy/byobu/wheezy

« back to all changes in this revision

Viewing changes to bin/ip_address

  • Committer: Bazaar Package Importer
  • Author(s): Dustin Kirkland
  • Date: 2009-09-21 11:27:09 UTC
  • mfrom: (1.1.5 upstream) (0.1.33 karmic)
  • Revision ID: james.westby@ubuntu.com-20090921112709-uc9331o7ricmafiy
* bin/users: use wc -l, since pgrep -c doesn't work in some
  distros (busybox, Arch), LP: #434047
* byobu.1: fix manpage, mem_used was listed twice, mail was in the wrong
  place, LP: #434052
* byobu-export.1, byobu-launcher.1, byobu-select-profile.1: minor manpage
  fixes, updating the names of the utilities to use "byobu" rather than
  "screen"

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
PKG="byobu"
21
21
 
22
22
if [ "$1" = "--detail" ]; then
23
 
        /sbin/ifconfig | grep "inet addr" | sed 's/^\s*//' | sed 's/\s*$//'
 
23
        /sbin/ifconfig | grep "inet addr" | sed -e 's/^\s*//' -e 's/\s*$//'
24
24
        exit 0
25
25
fi
26
26
 
27
 
. "/etc/$PKG/statusrc"
 
27
[ -r "/etc/$PKG/statusrc" ] && . "/etc/$PKG/statusrc"
28
28
. "$HOME/.$PKG/status"
29
29
[ "$hostname" = "1" ] && space=" "
30
30
[ "$whoami" = "1" ] && space=" "
31
31
 
32
 
interface=`tail -n1 /proc/net/route  | awk '{print $1}'`
33
 
ipaddr=`/sbin/ifconfig "$interface" | grep "inet addr:" | sed "s/^.*inet addr://" | sed "s/ .*$//"`
 
32
# Allow interface overrides in $HOME/.$PKG/statusrc
 
33
if [ -n "$MONITORED_NETWORK" ]; then
 
34
        interface="$MONITORED_NETWORK"
 
35
else
 
36
        interface=`tail -n1 /proc/net/route  | awk '{print $1}'`
 
37
fi
 
38
 
 
39
ipaddr=`/sbin/ifconfig "$interface" | grep "inet addr:" | sed -e "s/^.*inet addr://" -e "s/ .*$//"`
34
40
 
35
41
printf "%s\005{+b }%s\005{-}" "$space" "$ipaddr"