1、实现批量添加20个用户,用户名为user1-20,密码为user+123
#!/bin/bashcount=$1if [ -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; doneelse echo "$count is empty"fi
2、100个数相加,最大值,最小值
#!/bin/bashsum=0for i in `seq 0 1 99`do echo "第"$i"次" read -p "请输入数字" n a=$n sum=$[$sum+$n]doneecho "最大值"echo ${a}|sed 's//\n/g'|sort -r|sed -n '1'pecho "最小值"echo ${a}|sed 's//\n/g'|sort -n|sed -n '1'pecho $sum~