diff options
author | Epoch Qwert <epoch@53flpnlls43fcguy.onion> | 2014-11-28 04:30:18 -0600 |
---|---|---|
committer | Epoch Qwert <epoch@53flpnlls43fcguy.onion> | 2014-11-28 04:30:18 -0600 |
commit | a311bc2335bfb676b8a3dbca7b4910ae0923b81e (patch) | |
tree | 9a59e18b58697465613369ce5d209bf14fa95b47 /nocompile/bin/ifout | |
parent | 59bcef5c27540527fc4ca1007e9cfea5783ba233 (diff) | |
download | misc-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/bin/ifout')
-rwxr-xr-x | nocompile/bin/ifout | 6 |
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 |