Symlink notifyd.py to osd_server.py for backward compatibility
[grml-scripts.git] / usr_bin / myip
1 #!/bin/zsh
2 # Filename:      myip
3 # Purpose:       return IP address of running system on stdout (requires network access)
4 # Authors:       grml-team (grml.org), (c) Alexander Wirt <formorer@grml.org>
5 # Bug-Reports:   see http://grml.org/bugs/
6 # License:       This file is licensed under the GPL v2.
7 ################################################################################
8
9 # little helper functions that skips the httpheader of a site
10 function skip_httpheader {
11    for i in {1..7} ; do
12           read -u $REPLY LINE; 
13           if [[ "$LINE" == "\r" ]] ; then return ; fi
14   done
15 }
16
17 zmodload zsh/net/tcp
18 HOST=v4.showip.spamt.net
19 ztcp $HOST 80
20 print -u $REPLY "GET / HTTP/1.0\r\nHost: $HOST\r\n\r\n"
21 skip_httpheader
22 read -u $REPLY LINE
23 echo "$LINE"
24 ztcp -c $REPLY
25
26 ## END OF FILE #################################################################