Hey guys how do I compare 2 strings from the text file,
and check for duplication?
For example, I add an item call Laptop, it will record to the textfile call file.
If it detects duplicate it will say the record record exist?
file.txt contains
Laptop:Sony:1000
Phone:Apple:30
A head start would be fine for me, cuz I'm kinda new to shell scripting.
in simple speaking it says extract the lines that contains the value stored in the variable $title as a word then refine this extracted lines with another filter against the value stored in the variable $author then pass the out to some sort of line counter that what it says in final $c1 will hold a numeric value if conditions of combined filters are met.
I see no logical errors in the function
add_new_book
.
Also I see no string comparison in the snippet you sent except the pattern matching logic
hmmm ok..
So how do I compare both of the input of what the user want and the data in the text file?
Lets say user enter the title and author.
If it detects the same author it will say book existed?