我正在與廚師和紅寶石,我試圖運行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