简体   繁体   English

为数组赋值(Bash脚本错误)

[英]Assigning values to an array (Bash script error)

I have been told that you can assign values to an array and make it at the simultaneously in bash script using this code: 我被告知您可以使用以下代码为数组分配值并使用bash脚本同时进行:

arrayName[0]=1

However this does not work for me and keeps throwing up this error: 但是,这对我不起作用,并不断抛出此错误:

array[0]=1: not found

Can someone please point out the error of my ways 有人可以指出我的方式的错误

Are you sure you're doing exactly array[0]=1 ? 你确定你正在做array[0]=1吗? Having an extra space on any hand of the expression would break it. 在表达式的任何一只手上都有一个额外的空间会破坏它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM