The shell script that I have to write has to create new users and automatically assign them to groups. This is my code so far:echo -n Enter the username: read textuseradd $textI was able to get the shell script to add the new user (I checked the /etc/passwd entry). However, I have tried and I am not able to get a passwd (entered by the user) to the newly created user before. If anyone could help me assign a password to the newly created user it would be of much help. 
How to add users to Linux through a shell script
linux;shell script;users;password;group
Output from  man 1 passwd:--stdin      This option is used to indicate that passwd should read the new      password from standard input, which can be a pipe.So to answer your question, use the following script:echo -n Enter the username: read unameecho -n Enter the password: read -s passwdadduser $unameecho $password | passwd $uname --stdinI used read -s for the password, so it won't be displayed while typing.Edit: For Debian users -stdin won't work. Instead of passwd use chpasswd:  echo $uname:$passwd | chpasswd