#usage: make 10 directorys and change file mode bits
#name: mkdir.sh
#!/bin/sh
i=1
#be careful the space between "[" $i and while
while [ $i -le 10 ]
do
if [ -d /home/thmono/mkdir ]; then
mkdir -p /home/thmono/mkdir/dir$i
chmod 754 /home/thmono/mkdir/dir$i
echo "dir$i is made complete!!!"
i=$(($i+1))
else
mkdir /home/thmono/mkdir
mkdir -p /home/thmono/mkdir/dir$i
chmod 754 /home/thmono/mkdir/dir$i
echo "dir$i is made complete!!!"
i=$(($i+1))
fi
done
example of while [ ]
最新推荐文章于 2022-04-18 13:12:41 发布