I'm new to unix and the command line and am trying to learn different commands. I have a file (teledir.txt) that contains a name and phone number for 3 different people. I am writing a script that is to take two positional parameters and I typed out how it should behave:
if <name and number exists>; then
<echo matching line>
elif <name exists>; then
<echo line>
elif <number exists>; then
<echo matching line>; then
else
<if both name and number were provided, add them to the file>
fi
I declared two variables: name=$1
and number=$2
. But I'm lost on what command to use in the script to see if the name and/or number exists in the other file.
Any pointers?