Linux / UNIX Tech Support Forum
This is a discussion on Shell menu script to adduser within the Shell scripting forums, part of the Development/Scripting category; hi everyone i'm new to linux and needing a bit of help with a script this script is to create ...
|
|||||||
| Shell scripting You can discuss the shell scripting, request shell scripts and scripting techniques |
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
hi everyone
i'm new to linux and needing a bit of help with a script this script is to create a option menu of, adduser, show the date and quit. i'm struggling getting the adduser to work, could someone please help me with the following script? thank you #!/bin/bash ps3='Select Option and Press Enter:' select i in Adduser Date Quit do case $i in Adduser) $username;; Date) date;; Quit) break;; esac done |
| Sponsored Links | ||
|
|
|
||||
|
Try something as follows
Code:
#!/bin/bash
while [ 1 ]
do
clear
echo "1. Add user"
echo "2. Date and time"
echo "3. Exit"
read -p "Enter your choice [ 1 - 3 ] ?" ch
case $ch in
1)
read -p "Enter user name : " userName
useradd -m $userName
passwd $userName;;
2)
echo "Today is $(date)"
read -p "Press [Enter] to continue..." readDamKey;;
3)
exit 0;;
*) read -p "Wrong selection!!! Press [Enter] to continue..." readDamKey;;
esac
done
__________________
Vivek Gite Linux Evangelist |
|
|||
|
Hi
thanks a lot for this. really is appreciated! with more practice i'm hoping i can be the one to give advice. there is another script you could help me with. i'm wanting to add users to the system from a list, and i've also tried adding a password to each user, the password is the username plus 123 on the end. am i on the right tracks? #!/bin/bash for i in `names.lst` #text file with names in do echo $i adduser $i echo $i2123 |password -stdin "$i" #adds password automatically to each username echo; echo "$Username's and Passwords Updated!" done thanks again! |
|
||||
|
__________________
Vivek Gite Linux Evangelist Last edited by nixcraft; 05-05-2009 at 07:22 PM. Reason: Thread updated as Solved |
![]() |
| Tags |
| adduser , bash , linux , read , shell scripting , unix , useradd |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) |
|
| Thread Tools | |
| Display Modes | |
|
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Linux Menu Driven Network Information Program | gsb1bee | Networking, Firewalls and Security | 4 | 04-06-2009 02:15 PM |
| FTP SHELL Script | gsb1bee | Shell scripting | 3 | 24-04-2009 05:32 PM |
| Not a question: KDE Menu | nix CRAFT ROX | KDE | 0 | 15-12-2008 02:46 AM |
| Binary Conversion Of Shell Script (shell script compiler) | chandanperl | Shell scripting | 3 | 29-07-2008 10:22 AM |
| writing a shell script to find out my shell name | jaymob123 | Shell scripting | 1 | 08-10-2007 12:36 AM |