Bash scripts Add, remove Linux users

Source: Internet
Author: User

Bash scripts: Sequential execution in process-oriented programming: Default rules, execute each statement by execution: branching, conditional judgment, execution of the eligible branches; loop execution: The same piece of code is executed repeatedly for a limited number of times, so the loop must have an exit condition or it will fall into a dead loop ; Program code: Statements and expressions constitute control statements: Bash loop control statement: Forwhileuntilfor loop:for var_name in  list;  do Statement 1 Statement 2...donefor  userName in gentoo mandriva debian; douseradd  $userNamedone syntax error detection:#  bash -n  script File Write a script: Add 10 Users, user101-user110 list generation method: Generate a sequence of numbers: {start. End}, seq [start] [step] end#!/bin/bashfor username in  ' seq 101 110 ';  do  useradd user$userName  echo  "add user$username successfully." Done write a script: delete user102 user105 users                  #!/bin/bash                                  for username in user102 user105;                     do                  userdel  $userName                   echo  "del  $userName  successfully."                      done


This article is from the "-it commune" blog, please be sure to keep this source http://guangpu.blog.51cto.com/3002132/1547909

Bash scripts Add, remove Linux users

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.