summaryrefslogtreecommitdiff
path: root/nocompile/bin/hop0
blob: e7c3ff887151e1a11f480c355e7119c04e5107e7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
#!/bin/sh
if [ "_$(uname -s)" != "_Linux" ];then
 if echo $1 | grep ":" 2>&1 >/dev/null;then
  /sbin/route -n get -inet6 "$1" | grep "local addr" | cut -d: -f2- | tr -d ' '
 else
  /sbin/route -n get "$1" | grep "local addr" | cut -d: -f2 | tr -d ' '
 fi
else
 /sbin/ip r g "$1" | cut '-d ' -f8
fi