ruby 调用Linux 系统环境变量,比如
1
2
3
4
5
6
7
|
#!/usr/bin/env ruby
user =
ENV
[
'USER'
]
hostname =
ENV
[
'HOSTNAME'
]
puts
"current user is #{user}"
puts
"current hostname is #{hostname}"
|
本文转自 紫色葡萄 51CTO博客,原文链接:http://blog.51cto.com/purplegrape/1891555,如需转载请自行联系原作者