我正在与厨师和红宝石,我试图运行set命令。Ruby:试图运行设置命令
setVarList = %x(set)
如果我只需键入设置它工作正常,但如果我运行此脚本,我得到以下错误:
/var/chef/cache/cookbooks/motd/recipes/default.rb:22: command not found: set
有什么不对?
我正在与厨师和红宝石,我试图运行set命令。Ruby:试图运行设置命令
setVarList = %x(set)
如果我只需键入设置它工作正常,但如果我运行此脚本,我得到以下错误:
/var/chef/cache/cookbooks/motd/recipes/default.rb:22: command not found: set
有什么不对?
看起来你不会产生bash
shell。
set
是一个bash内置:
4.3.1 The Set Builtin
This builtin is so complicated that it deserves its own section. set allows you to change the values of shell options and set the positional parameters, or to display the names and values of shell variables.
set
set [--abefhkmnptuvxBCEHPT] [-o option-name] [argument …]
set [+abefhkmnptuvxBCEHPT] [+o option-name] [argument …]
If no options or arguments are supplied, set displays the names and values of all shell variables and functions, sorted according to the current locale, in a format that may be reused as input for setting or resetting the currently-set variables. Read-only variables cannot be reset. In POSIX mode, only shell variables are listed.
http://www.gnu.org/software/bash/manual/html_node/The-Set-Builtin.html
尝试运行ps -p $$
看哪个壳是越来越催生。
[email protected]:~$ ps -p $$
PID TTY TIME CMD
10018 ttys001 0:00.11 -bash
[email protected]:~$
感谢您的宝贵信息!如果我可以放弃,你会有一个。 – user2068979 2013-02-14 09:12:10
'setVarList =%x(/ bin/bash -c set)' – 2013-02-13 17:15:40