for example consider the following situation::
I need to print some numbers randomly one after the other with a time interval of 5 seconds between each, and I need to terminate the terminal process of printing numbers if i encounter an output of '2'. Is it possible.
I know I could do the same in c, c++, java, etc. etc,. But I would like to do it using bash script.
Note:: If only 'after' I encounter an 'output' of '2'(or anything) then the process needs to be terminated, I stress this because 'I need to terminate the terminal process for a particular outcome'.