You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.
This can be modified to be used in a creative way!
In this example I spawn a 30s delay and, while it is already counting down, do some other things in the meantime that are not related to the delay.
When I'm done doing things, I will wait for the remaining delay time:
delay() {
declare -i i=$1
coproc d {
read -n1 -s -t$i
}
}
delay 30
while [ -v d ]; do
echo "Doing things"
wait
done
You'd also be able to stop the delay prematurely by sending input to the pipe: echo > /dev/fd/${d[1]}
André
The text was updated successfully, but these errors were encountered:
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Hi,
First of all: THANK YOU! So glad I found this.
I noticed I run in a lot of defunct procs when using the sleep alternative in your docs, I don't know why yet, though.
As an alternative I found it useful to use coproc to give the sub process a stdin:
This can be modified to be used in a creative way!
In this example I spawn a 30s delay and, while it is already counting down, do some other things in the meantime that are not related to the delay.
When I'm done doing things, I will wait for the remaining delay time:
You'd also be able to stop the delay prematurely by sending input to the pipe:
echo > /dev/fd/${d[1]}
André
The text was updated successfully, but these errors were encountered: