I am working on an option which will be able to remove the line specified if the user types in the exact title and author.
However I will not be able to make it work
You're trying to pass a bash
variable (two, actually) into a sub-program (sed
), but surrounding the expression you're passing in single-quotes, which does no parameter expansion. That means that sed
is literally seeing $Title:$Author
. Try putting the whole sed
expression in double-quotes:
sed -i "/$Title:$Author/d" BookDB.txt
This will allow bash
to expand $Title
and $Author
before they get into sed
.