Re: eval doesn't close file descriptor?

2013-02-11 Thread Pierre Gaston
On Tue, Feb 12, 2013 at 1:54 AM, wrote: > With the script below, I'd expect any fd pointing to /dev/null to be > closed when the second llfd() is executed. Surprisingly, fd 3 is closed, > but fd 10 is now open, pointing to /dev/null, as if eval copied it instead > of closing it. Is this a bug? >

eval doesn't close file descriptor?

2013-02-11 Thread matei . david
With the script below, I'd expect any fd pointing to /dev/null to be closed when the second llfd() is executed. Surprisingly, fd 3 is closed, but fd 10 is now open, pointing to /dev/null, as if eval copied it instead of closing it. Is this a bug? Thanks, M $ bash -c 'llfd () { ls -l /proc/$BA

[Parameter Expansion] bug in ${variable% *}

2013-02-11 Thread Dashing
Bash version: 4.2.042 I have a script that behaves erratically: = #! /bin/bash last=${1##* } rest=${1% *} while [[ "${rest: -1}" == '\' ]]; do last="${rest##* } $last" oldrest=$rest rest=${rest% *} if [[ "$oldrest" == "$rest" ]]; then echo :

Re: SIGTERM ignored before exec race

2013-02-11 Thread Pádraig Brady
On 02/10/2013 08:30 PM, Chet Ramey wrote: On 2/9/13 12:02 AM, Pádraig Brady wrote: $ rpm -q kernel glibc bash kernel-2.6.40.4-5.fc15.x86_64 glibc-2.14.1-6.x86_64 bash-4.2.10-4.fc15.x86_64 I notice the following will wait for 5 seconds for the timeout process to end with SIGALRM, rather than imm

Re: Waiting for _any_ background process to terminate.

2013-02-11 Thread Alan Mackenzie
On Mon, Feb 11, 2013 at 02:34:53PM -0500, Greg Wooledge wrote: > On Mon, Feb 11, 2013 at 06:59:35PM +, Alan Mackenzie wrote: > > From a bash script, I'd like to be able to start several subtasks and > > react to any one of them completing. I don't think I can do this with > > the current bash.

Re: Waiting for _any_ background process to terminate.

2013-02-11 Thread Alan Mackenzie
On Mon, Feb 11, 2013 at 03:05:25PM -0500, Chet Ramey wrote: > On 2/11/13 1:59 PM, Alan Mackenzie wrote: > > Hi, bug-bash. > > From a bash script, I'd like to be able to start several subtasks and > > react to any one of them completing. I don't think I can do this with > > the current bash. The

Re: Waiting for _any_ background process to terminate.

2013-02-11 Thread Chet Ramey
On 2/11/13 1:59 PM, Alan Mackenzie wrote: > Hi, bug-bash. > > From a bash script, I'd like to be able to start several subtasks and > react to any one of them completing. I don't think I can do this with > the current bash. The `wait' function either waits on a specified subtask > to finish, or

Re: Waiting for _any_ background process to terminate.

2013-02-11 Thread Greg Wooledge
On Mon, Feb 11, 2013 at 06:59:35PM +, Alan Mackenzie wrote: > From a bash script, I'd like to be able to start several subtasks and > react to any one of them completing. I don't think I can do this with > the current bash. The `wait' function either waits on a specified subtask > to finish,

Waiting for _any_ background process to terminate.

2013-02-11 Thread Alan Mackenzie
Hi, bug-bash. >From a bash script, I'd like to be able to start several subtasks and react to any one of them completing. I don't think I can do this with the current bash. The `wait' function either waits on a specified subtask to finish, or for _all_ subtasks to finish. Am I mistaken about th

Is this intended behavior??

2013-02-11 Thread Bruce Korb
> /tmp > $ echo "$PS1" > \w\n\$ > /tmp > $ mkdir -p ZZ/a/b/c > /tmp > $ pushd ZZ > /tmp/ZZ /tmp > /tmp/ZZ > $ pushd a > /tmp/ZZ/a /tmp/ZZ /tmp > /tmp/ZZ/a > $ pushd b/c > /tmp/ZZ/a/b/c /tmp/ZZ/a /tmp/ZZ /tmp > /tmp/ZZ/a/b/c > $ popd /var/tmp > /tmp/ZZ/a/b/c /tmp/ZZ/a /tmp/ZZ > /tmp/ZZ/a/b/c > $ po