I writing a shell script, and in the script I would like to grep to perform an exact string match in another file. Whenever I try to do this, the variable that I save the grep return in does not give the right results when checking that value. Can someone please tell me if I am missing something. Below is the portion of the code that I am working with.
check=`grep -m 1 -w "$serial" $output`
if [ "$check" != "" ]
When this function is run and "test1" does not exist within the file but a the string "test" does exist, the conditional returns true. (should return false)
Thanks for the help.