#!/bin/sh if [ "_$(uname -s)" != "_Linux" ];then /sbin/route -n get "$1" | grep "interface" | cut -d: -f2 | tr -d ' ' else /sbin/ip r g "$1" | head -n1 | cut '-d ' -f3 fi