Skip to content

Instantly share code, notes, and snippets.

@adamwiggins
Created July 20, 2010 01:53
Show Gist options
  • Select an option

  • Save adamwiggins/482335 to your computer and use it in GitHub Desktop.

Select an option

Save adamwiggins/482335 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
usage = "pgurl <url> <command>"
url = ARGV.shift or abort usage
cmd = ARGV.shift or abort usage
require 'uri'
u = URI.parse(url)
ENV["PGPASSWORD"] = u.password
exec "#{cmd} -U #{u.user} -h #{u.host} #{u.path[1..-1]}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment