for i in $(seq 1 4 )
do
Dir=$(eval \$Directory_Main_$i)
if [ ! -d "$Dir" ]; then
echo "$Dir does not exist!"搏扒耐基春此老
exit;
fi
done
--------------
试试看对不
对于变量数轿答组
A[0]=0
A[1]=1
A[2]=2
A[3]=3
数组从0计数
==========
DIR=(./finish ./skeleton ./skeleton/revert/ ./skeleton/start/)闭键慧
之后按照大猩猩亮迅的说法来做
$DIR[*]
= =这样写不好雹磨樱
for i in ./finish ./skeleton ./skeleton/revert ./源丛skeleton/start
do
if [ ! -d "$i" ]; then
echo "$i does not exist!"
exit;
fi
done
效果一样,简化了游灶点
我运行了下,应该不会报错,但是输出的肯定不是你想要的,会输出类似1 does not exist
$(Directory_Main_$i)