2021-12-25

bash echo does not work after grep returns nothing

I understand that people generally use grep in Linux command prompt (not in a script). I happen to put grep in a script and run into a strange case. If the grep command returns nothing, the next line echo does not work. Below is the script.

grep "abc" /home/testuser/myapp.log
echo "abc"

Is this the normal behavior of grep? If yes, why?



from Recent Questions - Stack Overflow https://ift.tt/3qrtHwf
https://ift.tt/eA8V8J

No comments:

Post a Comment