Please check the script errors

Source: Internet
Author: User
I would like to ask you to check the Script Error-general Linux technology-Linux technology and application information. The following is a detailed description. The following are two scripts for batch addition and deletion of users. I hope you can see what went wrong.
#! /Bin/bash
I = 1
Read-p "Enter the number of users you want to create:"
Read-p "Enter the username Prefix:" B
Read-p "Enter the user expiration time:" C
Read-p "Enter your initial password:" D
While [$ I-le $ A]
DO
If [$ I-lt 10]; then
USE = $ B0 $ I # Here 0 is a number
Else
USE = $ B $ I
If
Useradd-e $ C $ USE
Echo "$ D" | passwd -- stdin $ USE &>/dev/null
Let I ++
Done
The above is the add user. The following two scripts correspond to each other to the delete user.
#! /Bin/bash
I = 1
Read-p "Enter the username prefix you want to delete in batches:"
Read-p "Enter the number of users you want to delete:" B
While [$ I-eq $ B]
Do
If [$ I-lt 10]; then
USE =$ {A} 0 $ I
Else
USE = $ A $ I
Fi
Userdel-d $ USE | grep-v "root"/etc/passwd | cut-d "root"
Let I ++
Done
The above script has errors. I hope the prawns can help me with the dishes ~~!
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.