shell-创建文件夹和文件

知识点:
if条件语句。
for循环语句。

#!/bin/sh
#
cd /var/www/shell
if [ ! -d file ]
then
        mkdir file
fi

cd file

for ((i=0; i<10; i++));do
        if [ ! -f file_{$i}.txt ]
        then
                touch file_$i.txt
        fi
done
JackSun

JackSun

I'm a coder.

You may also like...

No Responses

  1. 威客众包 says:

    谢谢博主分享

  2. 路过,留个脚印,网站很棒!

Leave a Reply

Your email address will not be published.