标签:log 批量添加 read bsp count 个数 std passwd for
1、实现批量添加20个用户,用户名为user1-20,密码为user+123
#!/bin/bash count=$1 if [ -n "$count" ] then for ((i=1;i<=$count;i++)) do useradd -d /home/user_$i -s /bin/bash user_$i; echo user_"$i"123 |passwd --stdin user_$i; done else echo "$count is empty" fi
2、100个数相加,最大值,最小值
#!/bin/bash sum=0 for i in `seq 0 1 99` do echo "第"$i"次" read -p "请输入数字" n a=$n sum=$[$sum+$n] done echo "最大值" echo ${a}|sed ‘s//\n/g‘|sort -r|sed -n ‘1‘p echo "最小值" echo ${a}|sed ‘s//\n/g‘|sort -n|sed -n ‘1‘p echo $sum ~
标签:log 批量添加 read bsp count 个数 std passwd for
原文地址:http://www.cnblogs.com/Nyan-Workflow-FC/p/6245740.html