Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted!
-
The problem statement, all variables and given/known data:
write a script that will :
a) given the file name last_names exists in the current directory
b) use a loop to prompt for 5 text lines that the user can enter last name on
c) if the name entered is not in the file then add it to the file -
Relevant commands, code, scripts, algorithms:
-
The attempts at a solution (include all code and scripts
!/bin/bash
echo -n "Enter 5 last names"
read guess
for guess in 1 2 3 4 5
do
echo -n "Enter another last time: "
read name
if [ "$guess" -ne "$last_name" ]
then
echo "$guess" >> "$last_name"
else
echo "ok."
fi
done
- Complete Name of School (University), City (State), Country, Name of Professor, and Course Number (Link to Course):
EMU , MI , Linda Kinczkowski, NITA 412
Note: Without school/professor/course information, you will be banned if you post here! You must complete the entire template (not just parts of it).