linux - How to do something with Bash when a text line appears in a file -


i want run command text appears in log file. how do in bash?

use command

tail -f file.log | grep --line-buffered "my pattern" | while read line   echo $line done 

the --line-buffered key here, otherwise read fail.


Comments

Popular posts from this blog

windows - Why does Vista not allow creation of shortcuts to "Programs" on a NonAdmin account? Not supposed to install apps from NonAdmin account? -

visual studio - Deleting lines of code in a text editor -

What's the encoding type of Android 2.2 push message? -