Re: How difficult would it be to add a timeout to "wait"?

2023-04-21 Thread Chet Ramey
On 4/21/23 11:34 AM, Dale R. Worley wrote: My interest here isn't "Can I accomplish this task with Bash?" but quite literally, Can I make this a *feature* of Bash so I don't have to set up the mechanics? (I already know of a couple of other ways to do it with Bash.) My point is that if it's

Re: How difficult would it be to add a timeout to "wait"?

2023-04-21 Thread Dale R. Worley
Chet Ramey writes: > On 4/20/23 1:53 PM, Dale R. Worley wrote: >> How difficult would it be to add an optional timeout argument to the >> "wait" builtin? > > Try a variant of this. > ... My interest here isn't "Can I accomplish this task with Bash?" but quite literally, Can I make this a

Re: How difficult would it be to add a timeout to "wait"?

2023-04-20 Thread Chet Ramey
On 4/20/23 1:53 PM, Dale R. Worley wrote: How difficult would it be to add an optional timeout argument to the "wait" builtin? Try a variant of this. trap 'echo timeout!' USR1 # choose your fighter wait_with_timeout() { pid=$1 timeout=$2 { sleep $timeout && kill