冰镇可乐 发表于 2018-8-27 11:59:33

用户操作_shell脚本

  工作环境:Red Hat Enterprise Linux Server>  #!/bin/bash
  #
  for i in `seq -w 1 10`
  do
  echo "user$i添加成功"
  read -s -p "input passwd:" pass
  while [ ${#pass} -lt 6 ]
  do
  echo ""
  read -s -p "input passwd error ,the number of passwd must bigger than 6:" pass
  ((count++))
  if [ $count -gt 3 ];then
  echo "f**k you "
  exit
  fi
  done
  echo "$pass"
  read -p"want to del the user (yes/no):" choice
  [ $choice == "yes" -o $choice == "y" ] && echo "del start"
  [ $choice == "no" -o $choice == "n" ] && echo "don't del"
  [ $choice != ^yes-o $choice != ^no ]&& echo "please input (yes/no)!!!"
  done
  注意:只是简单的示例,并不会添加和删除用户

页: [1]
查看完整版本: 用户操作_shell脚本