linux help - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

linux help

Hey, I'm kinda new here and I'm here to ask you for a favor. So I've got a homework on linux programming and I'll need to explain this whole script to my lecturer in tomorrow. Can any of you please explain what does each segment of this script does? Thanks in advance.


echo '1. New entry (Name, Surname, phone number, e-mail):'
echo '2. Entry search'
echo '3. List all entries'
echo '4. Delete an entry'
echo '5. Edit an entry'
echo '6. Quit'

while [ $choice -ne 6 ]

read choice

case $choice in

echo 'Ener Name, surname, phone number and e-mail, separated by spaces:'
read id
echo $id >> info.txt

echo 'Enter id data to search for:'
read search
grep -n $search info.txt

echo 'Full entry-list:'
cat -n info.txt

echo 'Specify an entry # for removal:'
cat -n info.txt
read del
sed $del'd' info.txt>temp
mv temp info.txt
cat -n info.txt

echo 'Specify an entry # for editing:'
cat -n info.txt
read edit
echo 'Enter new data:'
read id
sed -i "${edit} s/.*/${id}/" info.txt

echo 'bye'

echo 'Wrong selection'
Sign In or Register to comment.