Skip to content

Instantly share code, notes, and snippets.

@tkuchiki
Last active December 27, 2015 03:48
Show Gist options
  • Select an option

  • Save tkuchiki/7261855 to your computer and use it in GitHub Desktop.

Select an option

Save tkuchiki/7261855 to your computer and use it in GitHub Desktop.
ruby で nginx -V から version を抽出 (1.8 対応)
`nginx -V 2>&1`
require 'open3'
stdin, stdout, stderr = Open3.popen3("nginx -V")
version = stderr.read.match(/nginx version: nginx\/(\d\.\d\.\d)/)[1]
p version
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment