echo "**********************" echo "Adding a new inhabitant..." echo "**********************" echo -n "Give me the first name of the inhabitant: " read fname echo -n "Give me the last name: " read lname echo -n "Give me the room number: " read room exists="true" while [ $exists == "true" ]; do echo -n "Please give me the code of the apartment you want to be added: " read code gawk '{print $NF}' apartment | if ( grep -q $code ); then echo "The code exists" else echo "Code successfully added" exists="false" echo "Now \"exists\" is $exists " fi done echo "Inhabitant: $fname $lname with room number $room live on $code" >> inhabitant_file echoHere is the apartment file:Name of the apartment: "house1" with code :: 90Name of the apartment: "house2!" with code :: 80Name of the apartment: "rush hour" with code :: 100Name of the apartment: "fly away" :: 10Name of the apartment: "flying high" :: 20Name of the apartment: "into the summer sky" with code :: 50Here is some strange output:Give me the first name of the inhabitant: test1Give me the last name: checkGive me the room number: A50Please give me the code of the apartment you want to be added: 90The code existsPlease give me the code of the apartment you want to be added: 80The code existsPlease give me the code of the apartment you want to be added: 100The code existsPlease give me the code of the apartment you want to be added: 10The code existsPlease give me the code of the apartment you want to be added: 20The code existsPlease give me the code of the apartment you want to be added: 50The code existsPlease give me the code of the apartment you want to be added: 1The code existsPlease give me the code of the apartment you want to be added: 2The code existsPlease give me the code of the apartment you want to be added: 3Code successfully addedNow "exists" is falsePlease give me the code of the apartment you want to be added:**********QUSETION 1: Code 1 exists?something wrong from grep? I see that it doesn't..QUESTION 2:What can be done for the loop to break so the script writes the variables into the file?***********