ash 数组操作

for myi in 0 1 2 ; do
eval mvar$myi=$myi
done

myi=1
eval newvar="\$mvar$myi"
echo $newvar

eval newvar="\$mvar0"
echo $newvar

-----------------------------------------------------------

eval mvar0=0
eval mvar1=2
eval mvar2=3

eval newvar="\$mvar0"
echo $newvar
eval newvar="\$mvar2"
echo $newvar

posted @ 2022-08-05 15:25  MoonXu  阅读(400)  评论(0编辑  收藏  举报