Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/bash/18.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
无法在UpStart中声明数组,但可以在bash中声明_Bash_Ubuntu_Sh_Upstart - Fatal编程技术网

无法在UpStart中声明数组,但可以在bash中声明

无法在UpStart中声明数组,但可以在bash中声明,bash,ubuntu,sh,upstart,Bash,Ubuntu,Sh,Upstart,这是我遇到的一个问题的示例—试图在Upstart中声明一个数组。我可以在bash提示符下运行declare行,但是当通过upstart脚本完成时,它会无声地失败 description "bla" author "yea" start on runlevel [2345] script echo "yo" >> /var/log/arr.log 2>&1 declare -a MYARR=("1,2" "3,4") echo "stuff" e

这是我遇到的一个问题的示例—试图在Upstart中声明一个数组。我可以在bash提示符下运行declare行,但是当通过upstart脚本完成时,它会无声地失败

description "bla"
author "yea"
start on runlevel [2345]
script
    echo "yo" >> /var/log/arr.log 2>&1
    declare -a MYARR=("1,2" "3,4")

    echo "stuff"
end script
我在ubuntu 14.04上做这个


谢谢

脚本代码将使用/bin/sh执行。数组在纯bourne shell中无法工作

看一看