0% found this document useful (0 votes)
8 views6 pages

ASS 1 Os

Uploaded by

Sahil Zaware
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views6 pages

ASS 1 Os

Uploaded by

Sahil Zaware
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Name:-OMKAR SACHIN PHAPALE.

Roll no:-14 Assignment no.1

……………………………………………………………………………………………………………………………………………..

echo -e "Address Book\n"

echo -e "File name:"

read fname

touch $fname

echo -e "id \t name \t mobile_no \t salary \t location \t" >> $fname

ch=0

while [ $ch -lt 7 ]

do

echo -e "1) Create Address Book\n"

echo -e "2) View Address Book\n"

echo -e "3) Insert a Record\n"

echo -e "4) Delete a Record\n"

echo -e "5) Modify a Record\n"

echo -e "6) Search a Record\n"

echo -e "7) Exit"

echo "Enter Your Choice:"

read ch

case $ch in

1)

echo "Enter number of records:"

read n

for((i=0;i<$n;i++))

do

echo "Enter id:"

read id

echo "Enter name:"


read name

echo "Enter mobile number:"

read mno

echo "Enter salary:"

read sal

echo "Enter location:"

read loc

echo -e "$id \t $name \t $mno \t $sal \t $loc" >> $fname

done

;;

2)

cat $fname

;;

3)

echo "Enter id:"

read id

echo "Enter name:"

read name

echo "Enter mobile number:"

read mno

echo "Enter salary:"

read sal

echo "Enter location:"

read loc

echo -e "$id \t $name \t $mno \t $sal \t $loc " >> $fname

;;

4)

echo "Enter Employee ID to delete:"

read id
if grep -w $id $fname

then

grep -wv $id $fname >>temp

rm $fname

mv temp $fname

else

echo "record not found"

fi

;;

5)

echo "Enter Employee ID to modify:"

read id

if grep -w $id $fname

then

grep -wv $id $fname >>temp

rm $fname

mv temp $fname

echo "Enter e_id:"

read id

echo "Enter name:"

read name

echo "Enter mobile number:"

read mno

echo "Enter salary:"

read sal

echo "Enter location:"

read loc

echo -e "$id \t $name \t $mno \t $sal \t $loc " >> $fname

else
echo "record not found"

fi

;;

6)

echo "Enter Employee id to search:"

read id

if grep -w $id $fname

then

echo "Record found"

else

echo "record not found"

fi

;;

*)

esac

done

output:

enter file name

Student

1.create 2.search 3.display 4.delete 5.modify 6.exit

enter the choice 1

enter the rollno 01

enter the name: Rohan

ASSIGNMENT_NO1.sh: 76: read: arg count

1.create 2.search 3.display 4.delete 5.modify 6.exit

enter the choice 1

enter the rollno 02

enter the name Troy

ASSIGNMENT_NO1.sh: 76: read: arg count


1.create 2.search 3.display 4.delete 5.modify 6.exit

enter the choice 2

enter the rollno

which you want to serach 1

01 Rohan Troy

ASSIGNMENT_NO1.sh: 76: read: arg count

1.create 2.search 3.display 4.delete 5.modify 6.exit

enter the choice 3

01 Rohan 02 Troy

ASSIGNMENT_NO1.sh: 76: read: arg count

1.create 2.search 3.display 4.delete 5.modify 6.exit

enter the choice 4

enter the rollno

which you want 02 02 Troy record delete

ASSIGNMENT_NO1.sh: 76: read: arg count

1.create 2.search 3.display 4.delete 5.modify 6.exit

enter the choice 3

01 Rohan

ASSIGNMENT_NO1.sh: 76: read: arg count

1.create 2.search 3.display 4.delete 5.modify 6.exit

enter the choice 5

enter the rollno which you want

01 01 Rohan

enter new name Ronny

enter new rollno 08

ASSIGNMENT_NO1.sh: 76: read: arg count

1.create 2.search 3.display 4.delete 5.modify 6.exit

enter the choice 3 08 Ronny

ASSIGNMENT_NO1.sh: 76: read: arg count


1.create 2.search 3.display 4.delete 5.modify 6.exit

enter the choice 6

ASSIGNMENT_NO1.sh: 74: exit: Illegal number: thank

You might also like