Re: Strange behavior with job control

2010-07-27 Thread Christoph Dittmann
On 07/27/2010 02:35 PM, Greg Wooledge wrote: > On Tue, Jul 27, 2010 at 01:44:26PM +0200, Christoph Dittmann wrote: >> What I was going for was a script which executes another command with a >> timeout. > > http://mywiki.wooledge.org/BashFAQ/068 The process I want to put under

Re: Strange behavior with job control

2010-07-27 Thread Christoph Dittmann
On 07/27/2010 02:05 PM, Eric Blake wrote: > On 07/27/2010 05:44 AM, Christoph Dittmann wrote: >> What I was going for was a script which executes another command with a >> timeout. > > If you can assume the presence of GNU coreutils, use timeout(1). Much > nicer for this

Re: Strange behavior with job control

2010-07-27 Thread Christoph Dittmann
On 07/27/2010 12:05 PM, Andreas Schwab wrote: > If you want to kill the whole background job you need to enable job > control (set -m) and call kill with the job specifier instead (kill %2 > in this case). > >> How can the wait call affect a job it's not supposed to wait for? > > It's a simple ra

Strange behavior with job control

2010-07-26 Thread Christoph Dittmann
Hi, consider the following script: #!/bin/bash sleep 0.5 & if [[ $1 = a ]]; then sleep 5 & else { sleep 5; } & fi PID=$! wait %1 kill $PID ps aux | grep '[s]leep 5' exit 0 When I run this script with parameter "a" I get the following output: ./foo.sh: line 11: 12132 Terminated