Linux Common commands exercise: Useradd Userdel

Source: Internet
Author: User

Exercise: Write a script that ends with a task

1 , add 5 users, user1,..., user5

2 , each user's password with the user name, and requirements, add the password after the completion of the passwd command does not display the results of information;

3 , each user added after the completion, to show that the user has been successfully added;

Useradd user1

echo "User1" | passwd--stdin user1 &>/dev/null

echo "Add user1 successfully."

4, use a variable to save a user name;

5, delete the user in this variable, and delete their home directory;

6, display the "User Delete complete" class information;

Name=user1

Userdel-r $NAME

echo "The $NAME is Del"



This article is from the "Learn Linux history" blog, please be sure to keep this source http://woyaoxuelinux.blog.51cto.com/5663865/1863089

Linux Common commands exercise: Useradd Userdel

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.