I'm trying to grep from a file log and store it on a variable in bash. The line that I need to grep starts with *** Failure.
I've tried to store the results by doing:
response=`grep -m1 "Failure" "$LOGPATH"`
the var LOGPATH contains full file path for the log file. But when I run this command the result is: A list of all files on current dir, the line that I'm searching off example:
source3.sh source4.sh to_reproc workdir workspace.code-workspace wrkdir Failure 9134 Unmatched value in date string
to_reproc, workdir, workspace.code-workspace wrkdir are all folders, source3.sh source4.sh are shells files present in currently dir. I have a similar script doing the same thing, but instead of a fixed value it greps from a array and it works as intended. What I'm doing wrong here?