Pastie now auto-senses if line-wrap is a bad or good idea. Feedback?
## mark a section (Learn more)
#!/usr/bin/ruby require 'facter' pattern = "/usr/bin/ruby" ps = Facter["ps"].value regex = Regexp.new(pattern) ary = [] IO.popen(ps) { |table| table.each { |line| if regex.match(line) ary = line.sub(/^\s+/, '').split(/\s+/) end } } ary[1] != nil ? puts("Pid is: #{ary[1]}") : puts("Could not find the pid")
This paste will be private.
From the Design Piracy series on my blog: