bash - Faulty tail syntax or grep command? -


I have been given the following code:

  tail -fn0 / var / log / message | \ Read the line while; Repeat "$ Line" | Grep "test" if [$? = 0] "Running information to collect" etc. ... etc  

What to do, which constantly monitors the additional lines of "/ var / tmp / messages" file and if one In the word "test" is the word, then executes the rest of the script and goes out when it is done.
The Any row is added to this message's file, as if the remaining script is executing the line content I have added the echo commands, and the new log file line in the line line is correct By the way I tried to change the test "$? = 0" to "$? = 1", but it does not matter. Can someone give me an indicator?

Thanks @TomFrench

I recommend that instead of using a loop, you can use things like grep You can make it very simple:

  tail-fn0 / var / log / messages Grep -q test exclamation "gathering information" # left script exits after match before script  

grep -q , so your script will be released first Match is found.


Comments

Popular posts from this blog

apache - 504 Gateway Time-out The server didn't respond in time. How to fix it? -

c# - .net WebSocket: CloseOutputAsync vs CloseAsync -

c++ - How to properly scale qgroupbox title with stylesheet for high resolution display? -