From c6fc1470c496df30dc1192c14c8fcd33914f6413 Mon Sep 17 00:00:00 2001 From: Sami Samhuri Date: Tue, 23 Nov 2010 20:22:09 -0800 Subject: [PATCH] simplify whatismyip --- whatismyip | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/whatismyip b/whatismyip index c521f3f..9bc7c52 100755 --- a/whatismyip +++ b/whatismyip @@ -1,13 +1,5 @@ -#!/usr/bin/env ruby +#!/bin/sh +# +# could be an alias but I'll leave it here anyway -require 'open-uri' - -open('http://whatismyip.com') do |f| - puts "Open failed: #{f.status.inspect}" unless f.status.first == "200" - # WhatIsMyIP.com - 207.81.136.119 - title = f.gets while title !~ /WhatIsMyIP\.com - (\d[\d.]+)</ - ip = $1.chomp - ENV['SHELL'] = '/bin/bash' - `echo -n "#{ip}" | pbcopy` - puts ip -end +curl http://www.whatismyip.com/automation/n09230945.asp