Posts

Showing posts from November, 2014

OSA: Lower case to upper case conversion and vice-versa

while(true) do echo " MENU ______________________________________________________________________________ 1)Create a file and write into it 2)Convert Lower to Upper case 3)Convert Upper to Lower case 4)open file 5)Exit" read choice case $choice in 1) echo " Create and Write ------------------------------------------------------------------------------ Enter the name of file to be created ->" read filename if [ -f $filename ]; then echo "filename $filename already exists,please try another filename" else touch $filename chmod 777 $filename # echo "Enter the data to be written into the file ->" # read data # cat>$filename fi ;; 2) echo " Convert from Lower to Upper ------------------------------------------------------------------------------ Loading and translating Existing file :- $filename " tr '[a-z]' '[A-Z]' <$filename ;; 3) echo "

OSA: Display O.S. name,login name,host-name

while(true) do echo " MENU ------------------------------------------------------------------------------ 1)Print O.S. name 2)Dispaly login name 3)Display host name 4)Exit Please enter your choice -> " read choice case $choice in 1) echo "OS name -> " uname    echo "OS version -> " cat /proc/version ;; 2) echo "Login name -> " whoami ;; 3) echo "Host name -> " hostname ;; 4) echo "program will be terminated " exit 0 ;; esac done

OSA: Process mangement

while(true) do echo " MENU ------------------------------------------------------------------------------ 1)Display current shell 2)Display information of processes 3)Display global priority of processes 4)Change a priority of a process 5)Exit Enter your choice -> " read choice case $choice in 1) echo " displaying current shell ------------------------------------------------------------------------------ " ps ;; 2) echo " Information of processes ------------------------------------------------------------------------------ " ps -al ;; 3) echo " Display global priority of processes ------------------------------------------------------------------------------ " ps -ecl ;; 4) echo " Change priority ------------------------------------------------------------------------------ " ps -ecl echo "Enter process ID" read PID echo "Enter new priority valu

OSA: Directory- create,delete,display PWD and change directory

while(true) do echo " MENU ------------------------------------------------------------------------------ 1)Make a new directory 2)Delete a directory 3)Display current working directory 4)Change directory" read choice case $choice in 1) echo " New directory ============================================================================== Enter name of directory to be created ->" read name if [ -d $name ]; then echo "directory already exists, please try another name" else mkdir $name echo "directory has been created successfully" fi ;; 2) ls echo " Delete directory ============================================================================== Enter the name of directory to be deleted ->" read dname if [ -d $dname ]; then rmdir $dname echo "directory has been deleted  " else echo "invalid name, please try a valid directory name" fi ;; 3) ech

OSA: User- add,delete,change access permissions for a file

while(true) do echo " MENU ------------------------------------------------------------------------------ 1)Super User 2)Add user 3)Delete user 4)Change access permissions 5)Exit" read choice case $choice in 1) echo "act as super user inorder to add user ==============================================================================" su sh 3.sh s ;; 2) echo " add user ============================================================================== Enter the User name -> " read name useradd $name echo "User added successfully" ;; 3) echo " Delete user ============================================================================== Enter the name of user to be deleted -> " read username userdel userdel $username echo "the user has been deleted" ;; 4) echo " change access permissions ==============================================================

OSA: File management (Create,rename,delete and list the file's in present working directory)

while(true) do echo  " Enter operation you want to perform ------------------------------------------------------------------------------ 1)Create a File 2)Rename a File 3)Delete a File 4)List File's " echo "enter your choice->" read choice case $choice in 1) echo "Enter the name of file to be created" read filename if [ -f $filename ]; then echo "file already exists,please try another name" else touch $filename echo "file has been created successfully" fi # ;; 2) echo "Enter the name of File to be renamed " read oldfilename if [ -f $oldfilename ]; then echo "enter the new file name to be assigned " read newfilename mv $oldfilename $newfilename else echo "file doesn't exist please try an existing filename" ls fi # ;; 3) echo "Enter name of File to be deleted " read name if [ -f $name ]; then rm -f $name echo "file ha