Basic Bash Scripting in Linux (Part-1)
Script for adding users and their password: ==================================== (1) Method-1 ============= [root@itbd ~]# vim users.sh for a in `seq 1 5`; do useradd ituser$a; echo pass$a | passwd --stdin ituser$a; chage -d 0 ituser$a; done [root@itbd ~]# chmod +x user.sh [root@itbd ~]# bash users.sh (2) Method-2 ============ [root@itbd ~]# vim admin-user.txt mamun imran shazzad [root@itbd ~]# vim users.sh #!/bin/sh for a in `more admin-user.txt` do echo "$a" useradd $a echo "123" | passwd --stdin "$a" chage -d 0 $a done [root@itbd ~]# chmod +x user.sh [root@itbd ~]# bash users.sh Method-3: ========== #vim user-list.txt mushfiq:mushfiq123:1003:1003::/home/mushfiq:/bin/bash testuser:testuser123:1004:1004::/home/testuser:/bin/bash demouser:demouser123:1005:1005::/home/demouser:/bin/bash # newusers user-list.txt ...