Using grep and saving to text file
In a script, I'm running a command that builds a program- I wan't to grep "Build OK", but I would also like to save all of the output to a txt file. At the moment I'm doing this:
tempValue=$(sv -exec "cd $testPath; build; exit" $viewName | grep "Build OK")
This saves "Build OK" to tempValue if it's found and dosn't print anything on the screen, but if it's not found, alot of text is printed.
Where should I add the "< textfile.txt" to save the output, and what can I do so that the output is not echoed if "Build OK" isn't found?