How to disable the bash command and count the number of lines coming from stdout?

I would like to do something like timeout 12s tail -f access.log | wc -l timeout 12s tail -f access.log | wc -l , but I do not see the output from wc . What needs to be done to do this?

+5
source share
1 answer

Use the --foreground with timeout :

 timeout --foreground 12s tail -f access.log | wc -l 

According to man timeout :

 --foreground when not running timeout directly from a shell prompt, allow COMMAND to read from the TTY and get TTY signals; in this mode, children of COMMAND will not be timed out 
+4
source

Source: https://habr.com/ru/post/1267303/


All Articles