Skip to content

Instantly share code, notes, and snippets.

@morganp
Created March 23, 2010 21:18
Show Gist options
  • Save morganp/341670 to your computer and use it in GitHub Desktop.
Save morganp/341670 to your computer and use it in GitHub Desktop.
#Small function to run a command and output return values
def do_and_report(command)
f = open("| #{command}")
g = Array.new
while (foo = f.gets)
g << foo
end
g.each do |element|
puts element
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment