我希望我的脚本能够定义一个空数组。如果预定义的条件成立,应该添加数组值。为此,我所做的是:
执行此脚本时,我遇到了一些错误,类似于这样:
declare -a FILES
file_count=0
if [ "$file_ext" != "$SUPPORTED_FILE_TYPE" ] ; then
echo "$file_ext is not supported for this task."
else
$FILES[$file_count] = $filename
file_count=$file_count+1
fi
执行此脚本时,我遇到了一些错误,类似于这样:
linux-softwares/launchers/join_files.sh: 51: [0]: not found