NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io


#!/bin/bash

function newuser(){ #function created named as new user
read -p "Please!. Give name of user - " addUN ##user should input name of user
if [[ $addUN =~ ^[A-Z|0-9|a-z]+$ ]]; then
sudo newuser $addUN ##proceed
echo -e " User Sucessfully added. " ##message is displayed

else #continue
"Please!. Give valid input." ##message displayed on the screen

fi #end of if statements
listing_user
}
function newgroup(){ ##function created name as newgroup
read -p "Please!. Give name of group - " addGRP #user should input name of group
if [[ $addGRP =~ ^[A-Z|0-9|a-z] ]]; then ##if function is used to check input value from user
sudo newgroup $addGRP ##group added procced
echo -e "Group Sucessfully added." ##message displayed on the screen
else
echo -e "Please!. Give valid input." #message displayed

fi #end of if statemnts
listing_user #function
}
function useredited(){ #function is created named as useredited
read -p "Please!. Give name of user which u want to edit - " editUN ##message displayed on the scren
if [[ $(grep $editUN /etc/group |wc -l) -eq 1 ]]; then ##id statements is used
read -p "Give new username - " newUN ##user should input the name
sudo usermod -l $newUN $editUN ##process
echo -e "Sucessfully user edited." #message of sucessfull is hown

else #continue
echo -e "Please!. Give valid input.." #message shown in screen when input is wrong

fi ##end of if statemnts
listing_user ## function called as manin function
}
function groupedited(){ ##fi=unction name is given as groupedited
read -p "Please!. Give name of group which you want to edit - " editGN ##message which will be displayed on the screen
if [[ $(grep $editGN /etc/group |wc -l) -eq 1 ]]; then ##if condition is used
echo -e "Give new group name which you want to edit- " ##user input is taken
read newGN ##read new groupname
sudo groupmod -n $newGN $editGN ##new groupname
echo -e "gSucessfully group edited." ##message shown

else ##continue
echo -e "Please!. Give valid input." ##message displayed on the screen

fi #end of if statements
listing_user ## function called as main function
}

function touserdelete(){ ##function names as touserdelete
read -p "Please!. Give name of user which you want to delete - " delUN #3message displayed on the screen
# if [[ $(grep $delUN /etc/group |wc -l) -eq 1 ]]; then
sudo userdel $delUN ##to delete username
echo -e "Sucessfully user deleted." ##message displayed on the screen



listing_user ##function called as main function
}
function groupdelete(){
read -p "Please!.Give name of group which you want to delete- " delGN
# if [[ $(grep $delGN /etc/group |wc -l) -eq 1 ]]; then
sudo groupdel $delGN ##process proceed
echo -e "Sucessfully group deleted." ##message displayed on the screen
listing_user #functon called as main function
}
function listing_user(){ ##function name is given as listing_user
echo -e "1. Press 1 to Add User " ##option to add user
echo -e "2. Press 2 Add group " ##option to add group
echo -e "3. Press 3 Edit user " ##optionto edit user
echo -e "4. Press 4 Edit group " ##option to edit group
echo -e "5. Press 5 delete user " ##option to delete user
echo -e "6. Press 6 delete group " ##option to delete group
read -p "Choose any option 1 yo 6: " listingoption
if [[ $listingoption =~ ^[1-6]+$ ]]; then ##if fucntion is used
case $listingoption in ##list of option
1) newuser ;; ##to add new user
2) newgroup ;; ##to add new group
3) useredited ;; ##to edit user
4) groupedited ;; ##to edit group
5) touserdelete ;; ##to delete user
6) groupdelete ;; ##to delete group
esac ##end of fucntion
fi ##if function end
}
listing_user ## function call from main function
Write a note in this area. It's really easy to share with others. Click here ...
     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.