简体   繁体   English

bash:数组变量替换错误

[英]bash : Bad Substitution on array variable

Below is my extract of the failure part:以下是我对失败部分的摘录:

if [[ -n "${war_to_be_deployed-}" ]] ; then
    [[ "${#runtime_args[@]-}" == "${#expected_runtime_args[@]-}" ]]             || _fatal "Failed runtime_args"     
    for ((i=0 ; i<${#runtime_args[@]-} ; ++i)); do

throws below error on bash GNU bash, version 4.4.20(1)-release (x86_64-pc-linux-gnu) .在 bash GNU bash, version 4.4.20(1)-release (x86_64-pc-linux-gnu)上引发以下错误。 What is it that I'm doing incorrect here?我在这里做错了什么? thank you.谢谢你。

${#runtime_args[@]-}: bad substitution

${#runtime_args[@]} is number of elements in the array. ${#runtime_args[@]}是数组中的元素数。 The trialing - is what triggers the error.试验-是触发错误的原因。 Is this script generated?这个脚本是生成的吗? It looks like a syntax error to me.对我来说,这看起来像是一个语法错误。

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

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