#!/bin/sh
#!/usr/bin/env bash
# __author__='Lilian Besson'
# __email__='lilian DOT besson AT normale DOT fr'
# __date__='mar. 12/03/2013 at 14h:56m:39s '
# __webaddress__='https://sites.google.com/site/naereencorp/conky'
# __license__='GPL v3'
#
# A simple script to give the hostname of your machine to Conky
#
# (c) Naereen Corp. 2013
webquery=`wget http://monip.org/ -q -O - | grep -Eo '[a-zA-Z\.-]*'`
if [ "X$?" = "X0" ]; then
echo "$webquery" | sed s{''{''{ | sed s{''{''{
else
webquery=`wget http://monip.org/ -q -O - | grep -Eo '[0-9\.]*'`
if [ "X$?" = "X0" ]; then
echo "$webquery" | sed s{''{''{ | sed s{''{''{
else
ret=`hostname`
if [ "X$?" = "X0" ]; then
echo "$ret"
else
echo "localhost"
fi
fi
fi