0 Members and 1 Guest are viewing this topic.
# Kulverstukas, http://newage.ql.lt/ ;; evilzone.org# 2011OS=`uname`LocalIP=""ExternIP=""case $OS in Linux) LocalIP="Local IP : "`ifconfig | grep 'inet addr:'| grep -v '127.0.0.1' | cut -d: -f2 | awk '{ print $1}'`;; FreeBSD|OpenBSD) LocalIP="Local IP: "`ifconfig | grep -E 'inet.[0-9]' | grep -v '127.0.0.1' | awk '{ print $2}'` ;; SunOS) LocalIP="Local IP : "`ifconfig -a | grep inet | grep -v '127.0.0.1' | awk '{ print $2} '` ;; *) LocalIP="Local IP : Unable to retrieve";;esacExternIP="External IP: "`wget -qO- http://icanhazip.com`echo "$LocalIP"echo "$ExternIP"
Put it into /bin/ folder
execute from anywhere with command: sh termip.sh
ExternIP="External IP: "`wget -qO- http://icanhazip.com`echo "$ExternIP"# it should be eitherExternIP=`wget -qO- http://icanhazip.com`echo "External IP: $ExternIP"# orecho "External IP: $(wget -qO- http://icanhazip.com)"
Thanks for clearing that out. I don't do bash scriptint at all so as I see here it looks ugly but it works...