6、shell批量创建目录
方式1:
#!/bin/sh
dir="data1 data2 data3 data4 data5"
mkdir /$dir
方式2:
#!/bin/sh
# 创建文件夹
for num in $(seq 1 12)
do
mkdir /data${num}
done
结果
drwxr-xr-x 2 root root 6 Feb 27 14:12 data1
drwxr-xr-x 2 root root 6 Feb 27 14:12 data2
drwxr-xr-x 2 root root 6 Feb 27 14:12 data3
drwxr-xr-x 2 root root 6 Feb 27 14:12 data4
drwxr-xr-x 2 root root 6 Feb 27 14:12 data5