我还需要增加key
,同时还要存储信息。例如:
key1=value
key2=value
依旧......
count = 7
while [ $count -gt -1 ]
do
key$count=${array[$count]}
let count=$count-1
echo $key
done
答案 0 :(得分:0)
您可以在此处使用declare
指令:
array=(10 20 30 40 50 60 70 80 90)
for ((count=7; count > -1; count--)); do
declare "key$count"="${array[$count]}"
done