Article 5E453 Loop with user input

Loop with user input

by
Masiel
from LinuxQuestions.org on (#5E453)
Hi! I am very new to this and I am reaching a roadblock that I have no idea how to get around. I am trying to create a script that will prompt the user to enter First Name, Last Name, City until exit is entered in the First Name. Displayed like this

First Name: Jane
Last Name: Doe
City: Dayton

First Name: John
Last Name: Smith
City: Cincinnati

Jane Doe Dayton
John Smith Cincinnati

So far I have this:

until [[ $Fname = "exit" ]];
do

read -p 'First Name: ' Fname
read -p 'Last Name: ' Lname
read -p 'City: ' Cname

echo $Fname $Lname $Cname

However, its not stopping after First Name: exit, it continues to Last Name, City, then it echo, but only the second pass of the loop. How do I get it to echo both passes? And how do I get it to stop after exit is entered?

This is part an of assignment for class, and we are like 3 weeks in, so I am very new. If that info is needed. Thanks so much for your help!latest?d=yIl2AUoC8zA latest?i=gNOa5HYkUOQ:UYqqnmgVMGI:F7zBnMy latest?i=gNOa5HYkUOQ:UYqqnmgVMGI:V_sGLiP latest?d=qj6IDK7rITs latest?i=gNOa5HYkUOQ:UYqqnmgVMGI:gIN9vFwgNOa5HYkUOQ
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments