From a311bc2335bfb676b8a3dbca7b4910ae0923b81e Mon Sep 17 00:00:00 2001 From: Epoch Qwert Date: Fri, 28 Nov 2014 04:30:18 -0600 Subject: added ifout because I'm too lazy to head and cut every time I just want the interface the OS would use when trying to reach an IP. --- nocompile/bin/ifout | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100755 nocompile/bin/ifout diff --git a/nocompile/bin/ifout b/nocompile/bin/ifout new file mode 100755 index 0000000..a922108 --- /dev/null +++ b/nocompile/bin/ifout @@ -0,0 +1,6 @@ +#!/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 -- cgit v1.2.3