aboutsummaryrefslogtreecommitdiffstats
path: root/nocompile
diff options
context:
space:
mode:
authorEpoch Qwert <epoch@53flpnlls43fcguy.onion>2014-11-28 04:30:18 -0600
committerEpoch Qwert <epoch@53flpnlls43fcguy.onion>2014-11-28 04:30:18 -0600
commita311bc2335bfb676b8a3dbca7b4910ae0923b81e (patch)
tree9a59e18b58697465613369ce5d209bf14fa95b47 /nocompile
parent59bcef5c27540527fc4ca1007e9cfea5783ba233 (diff)
downloadmisc-a311bc2335bfb676b8a3dbca7b4910ae0923b81e.tar.gz
misc-a311bc2335bfb676b8a3dbca7b4910ae0923b81e.zip
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.
Diffstat (limited to 'nocompile')
-rwxr-xr-xnocompile/bin/ifout6
1 files changed, 6 insertions, 0 deletions
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