Sample Header Ad - 728x90

Use grep to search stdout, without replacing stdout

0 votes
1 answer
186 views
At the moment, I have this in a wrapper script:
2>&1 ./update.sh | ts | tee -a ./update.log
and this in update.sh:
if apt full-upgrade -y | grep linux-headers
then
    echo
    echo Need to Fix the Capture Driver!
fi
(there's some additional logic to fix the driver automatically, but I think you get the idea) It works, except that I don't get the full output of apt full-upgrade in the terminal or in the logfile. I only get what grep matches. I could probably tee the full output of apt full-upgrade to a temp file, before the if, and then grep and rm the temp file, but is there a better way than that to get a complete terminal and log, and keep the logic?
Asked by AaronD (153 rep)
Apr 28, 2024, 06:39 PM
Last activity: Apr 28, 2024, 08:04 PM