Logo 
Search:

Unix / Linux / Ubuntu Articles

Submit Article
Home » Articles » Unix / Linux / Ubuntu » Homework HelpRSS Feeds

Shell script to perform database operations for student data like view, add and delete records

Posted By: Gertrude Miller     Category: Unix / Linux / Ubuntu     Views: 14932

Write a shell script to perform database operations for student data like view, add and delete records and view database.

Code for Shell script to perform database operations for student data like view, add and delete records in Unix / Linux / Ubuntu

clear
i="y"
echo "Enter name of database "
read db
while [ $i = "y" ]
do
clear
echo "1.View the Data Base "
echo "2.View Specific Records "
echo "3.Add Records "
echo "4.Delete Records "
echo "5.Exit "
echo "Enter your choice "
read ch
    case $ch in
        1)cat $db;;
        2)echo "Enter id "
          read id
            grep -i "$id" $db;;
        3)echo "Enter new std id "
          iread tid
          echo "Enter new name:"
          read tnm
          echo "Enter designation "
          read des
          echo "Enter college name"
          read college
          echo "$tid    $tnm    $des    $college">>$db;;
        4)echo "Enter Id"
          read id
        # set -a
    #    sed '/$id/d' $db>dbs1
        grep -v "$id" $db >dbs1    
          echo "Record is deleted"
         cat dbs1;;           
        5)exit;;
        *)echo "Invalid choice ";;
    esac
echo "Do u want to continue ?"
read i
if [ $i != "y" ]
then
    exit
fi
done         
  
Share: 



Gertrude Miller
Gertrude Miller author of Shell script to perform database operations for student data like view, add and delete records is from Frankfurt, Germany.
 
View All Articles

Related Articles and Code:


 

Other Interesting Articles in Unix / Linux / Ubuntu:


 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
No Comment Found, Be the First to post comment!