How to Execute After Read?

johnywhy

New Member
Joined
Aug 4, 2019
Messages
7
Reaction score
3
Credits
0
In zsh, If i press enter before the read is finished, then the last echo command gets executed. Great!

Code:
read -t 10 && echo 'bye'

But, if i DON'T press enter, then the final echo does NOT get executed.

How can i ensure the final echo gets executed if i allow the read to finish?

thx
 
Last edited:


Update, some progress:
Read may behave a bit differently in zsh.

But this doesn't work either:
Code:
bash -c "read -t 5 && echo 'bye'"
 
Thx! i love this trick with read. Can't do this with sleep. Only way is with a loop :)
 


Latest posts

Top