输入:1 - > 2
while read -a line; do
if (( line[2] < 1 )); then
echo "Graph does not match known sites3"
exit
fi
done < "$2"
错误
syntax error: invalid arithmetic operator (error token is "")
由于某种原因,第[2]行不被视为数字2 ...... 我怎么能解决这个问题?
答案 0 :(得分:3)
获取最后一个数组元素:
$ x=( a z e r t y)
$ echo ${x[-1]}
y