Tuesday, June 18, 2013

UNIX/Linux Shell Script to delete multiple users



Example 1:

To delete the users: dummy1, dummy2, dummy3, dummy4 and dummy5

for  counter in {1..5}; do userdel dummy$counter; done

It can also be written as,

for counter in {1..5}
 do 
       userdel dummy$counter
 done

NOTE: {1..5} syntax will not work in certain shell. But it will work definitely in bash.

Example 2:

cat > user.list
vijay
sanjay
ajay
sujay


for  user in `cat  user.list`;do userdel $user;done

3 comments:

Oracle Fusion said...

It is really very excellent; I find all articles were amazing. Awesome way to get more tips from everyone............... R12 Financials Online Training

Tiffany said...

If you're looking for a date but not sure whether the dating site is a safe place, check our AssiaCharm Review review.

Patrick Co Eban said...


Networking Projects for Final Year CSE Students


The IEEE Network projects Networking Projects for Final Year CSE Students has direct impact on undergraduate and graduate student education and training. Final Year Engineering Students who are software developers can structure a project around building a network firewall application Final Year Project Centers in Chennai

JavaScript Training in Chennai

JavaScript Training in Chennai