Get external IP address at hotspot – with some error checking

In my conky setup, I call a file inet_test.  It’s a bash script, made executable and called by conky.

The core of it is getting an address from checkip.dyndns.org, but there’s one small problem.  Some public hotspots also have a login – such as Starbucks.  When I’ve connected, but before I log in, I’ll get a big jacked-up mess back.  This script basically checks for the length of the string returned, and if it’s longer than an IP4 address is allowed to be, it returns 0.0.0.0 back for my conky script.

Even if you don’t use conky, you might find it to be a useful standalone script.  Check it out on pastebin and try it out on your linux box.

Popular posts:

  • Moving Beyond Toxic Empathy
  • Odds and Ends: Optimizing SSHFS, moving files into subdirectories, and getting placeholder images
  • Advice Needed: How to Tell Someone They've Been Hit With A Publishing Scam
  • I am resigning as the programming director for Context, effective immediately.
  • Cinncinati Archdiocese to Employees: You must all be Catholic, and We Don't Trust You.
  • A helpful hint to politicians and groups that use call centers
  • Automagically Sort Downloads By Category with uGet on Windows and Linux (and replace KGet if you need to)