So I am hoping this is a very simple fix. I am still learning how to write some scripts but I have a file with a list of names such as:
I am trying to have the script check the value of it's $fname against the names in the file, if it is in there then it will store print the fname as the users first name if not then it will append the sname.txt file with that name and again print the first name.
here is what i got. Please don't berate me for how jacked up it may be.
#Displaying user first name storing to snames.txt
echo "Your first name please:"
for fname in snames.txt
if [ $fname = `| grep $fname sname.txt` ] ; then
elif [ $fname != `| grep $fname sname.txt` ] ; then
fname >> sname.txt ; then
#Displaying user last name storing to snames.txt
echo "Your Last name please:"
#for lname in snames.txt
# if [ $lname = | grep $lname sname.txt ] ; then
# elif [ $lname != | grep $lname sname.txt ] ; then
# lname >> sname.txt ; then
echo "Hello $stored_fname $lname, Lets be Friends!"
I decided to comment out the last name portion of it till i can get the first name portion. Any help would be appriciated. Thanks