いちいちフォームを読むことにこだわらなければこんな感じ

$ ruby -e 'require "net/http"; Net::HTTP.get_print("www.google.com", "/search?q=2ch+Ruby")'