#!/bin/zsh # Filename: myip # Purpose: return IP address of running system on stdout (requires network access) # Authors: grml-team (grml.org), (c) Alexander Wirt # Bug-Reports: see http://grml.org/bugs/ # License: This file is licensed under the GPL v2. # Latest change: Mon Aug 07 23:39:32 CEST 2006 [mika] ################################################################################ # little helper functions that skips the httpheader of a site function skip_httpheader { for i in {1..6} ; do read -u $REPLY LINE; done } zmodload zsh/net/tcp HOST=showip.spamt.net ztcp $HOST 80 print -u $REPLY "GET / HTTP/1.1\r\nHost: $HOST\r\n\r\n" skip_httpheader read -u $REPLY LINE echo "$LINE" ztcp -c $REPLY ## END OF FILE #################################################################