1 用for循环在/abc目录下批量创建20个文件,分别为file-1,file-2,,,,,,,file-20
#!/bin/bash
for num in `seq 20`
do
[ ! -d /abc ] && mkdir -p /abc
touch /abc/file-$num
done
新建文件:touch file-{1..20}
改名:rename file linux *linux*
2 echo {1..10}
seq -s " " -w 10
3 批量创建用户
#!/bin/bash
for num in `seq -w 20`
do
useradd -m user$num && echo "1234" | passwd --stdin user$num
done
设置随机密码
useradd -m user$num && \
echo "echo $RANDOM`openssl - rand -base64 8`|md5sum|cut -c 1-8" | passwd --stdin user$num
阅读(1449) | 评论(0) | 转发(0) |