Re: Any chance of multi-dimensional arrays?

2012-11-26 Thread Aharon Robbins
In article mailman.13825.1353909089.855.bug-b...@gnu.org, Eduardo Bustamante dual...@gmail.com wrote: There are a lot of general purpose languages (not shell languages), that support multi-dimensional arrays. And these languages can call external tools just fine. Python, Perl, Ruby, ... pick one.

Re: fd leak with {fd}

2012-11-26 Thread Chet Ramey
On 11/22/12 5:18 PM, Sam Liddicott wrote: As an interesting aside it seems not to be possible to close the FD within the block either: { echo $fd ; eval exec $fd- ; } {fd} /dev/null But this is not. There should be a way to ensure the fd's survival while

Re: problem with extended regular expression in bash 4.1

2012-11-26 Thread Greg Wooledge
On Sat, Nov 24, 2012 at 10:29:30PM +, Lawrence Steeger wrote: Alex Chupin (achupin achupin at cisco.com writes: $ bash --version; s=12345;if [[ $s =~ '^[0-9]+$' ]]; then echo it is a number; else echo it is NOT a number; fi The single quotes are being used in the match. If you remove

Re: fd leak with {fd}

2012-11-26 Thread Chet Ramey
On 11/23/12 2:04 AM, Pierre Gaston wrote: It seems rather counter intuitive that the fd is not closed after leaving the block. With the normal redirection the fd is only available inside the block $ { : ;} 31;echo bar 3 -bash: 3: Bad file descriptor if 3 is closed why should I expect

Re: fd leak with {fd}

2012-11-26 Thread Pierre Gaston
On Mon, Nov 26, 2012 at 3:37 PM, Chet Ramey chet.ra...@case.edu wrote: On 11/23/12 2:04 AM, Pierre Gaston wrote: It seems rather counter intuitive that the fd is not closed after leaving the block. With the normal redirection the fd is only available inside the block $ { : ;} 31;echo

Re: problem with extended regular expression in bash 4.1

2012-11-26 Thread chupin007
It changed between bash 3.1 and 3.2, documented in the NEWS file. There is a compat31 option that can be turned on to restore the 3.1 behavior. As you see it works for me in 3.25

Re: Any chance of multi-dimensional arrays?

2012-11-26 Thread Greg Wooledge
On Sun, Nov 25, 2012 at 06:33:19AM +0100, Rene Herman wrote: I'm currently writing a larger bash script to manage my (ogg vorbis) music collection, including maintaining tags. Vorbis files can and (mine) often will contain repeated tags such as, say, artist=David Crosby and artist=Graham

Re: problem with extended regular expression in bash 4.1

2012-11-26 Thread chupin007
Thank you guys for comprehensive explanation. Regards, Alexander Chupin

Re: fd leak with {fd}

2012-11-26 Thread Pierre Gaston
On Mon, Nov 26, 2012 at 3:41 PM, Pierre Gaston pierre.gas...@gmail.comwrote: On Mon, Nov 26, 2012 at 3:37 PM, Chet Ramey chet.ra...@case.edu wrote: On 11/23/12 2:04 AM, Pierre Gaston wrote: It seems rather counter intuitive that the fd is not closed after leaving the block. With the

Re: problem with extended regular expression in bash 4.1

2012-11-26 Thread Davide Brini
On Mon, 26 Nov 2012 15:03:35 +0100, Davide Brini dave...@gmx.com wrote: On Mon, 26 Nov 2012 05:40:09 -0800 (PST), chupin...@gmail.com wrote: It changed between bash 3.1 and 3.2, documented in the NEWS file. There is a compat31 option that can be turned on to restore the 3.1

Re: problem with extended regular expression in bash 4.1

2012-11-26 Thread Davide Brini
On Mon, 26 Nov 2012 05:40:09 -0800 (PST), chupin...@gmail.com wrote: It changed between bash 3.1 and 3.2, documented in the NEWS file. There is a compat31 option that can be turned on to restore the 3.1 behavior. As you see it works for me in 3.25 Then maybe you have the compat31

Re: fd leak with {fd}

2012-11-26 Thread Sam Liddicott
On Mon, Nov 26, 2012 at 1:49 PM, Pierre Gaston pierre.gas...@gmail.comwrote: On Mon, Nov 26, 2012 at 3:41 PM, Pierre Gaston pierre.gas...@gmail.comwrote: On Mon, Nov 26, 2012 at 3:37 PM, Chet Ramey chet.ra...@case.edu wrote: On 11/23/12 2:04 AM, Pierre Gaston wrote: It seems rather

Re: fd leak with {fd}

2012-11-26 Thread Chet Ramey
On 11/26/12 8:41 AM, Pierre Gaston wrote: On Mon, Nov 26, 2012 at 3:37 PM, Chet Ramey chet.ra...@case.edu mailto:chet.ra...@case.edu wrote: On 11/23/12 2:04 AM, Pierre Gaston wrote: It seems rather counter intuitive that the fd is not closed after leaving the block.

Re: fd leak with {fd}

2012-11-26 Thread Chet Ramey
On 11/26/12 9:26 AM, Sam Liddicott wrote: It seems that ksh93 behaves just like bash in this regard Well, as I don't use it I don't really care, but I vote for this as a bug as I fail to see the benefit of this behavior as i find it useless and not consistent with the

Re: problem with extended regular expression in bash 4.1

2012-11-26 Thread Chet Ramey
On 11/26/12 9:07 AM, Davide Brini wrote: Then maybe you have the compat31 option set (or your distro sets it for you), or you may have a patched, non-vanilla version of bash (redhat is well known for doing this). And indeed:

Re: fd leak with {fd}

2012-11-26 Thread Sam Liddicott
On Mon, Nov 26, 2012 at 5:02 PM, Chet Ramey chet.ra...@case.edu wrote: On 11/26/12 9:26 AM, Sam Liddicott wrote: It seems that ksh93 behaves just like bash in this regard Well, as I don't use it I don't really care, but I vote for this as a bug as I fail to see the benefit

Re: savestring() macro in general.h runs function arguments twice.

2012-11-26 Thread Chet Ramey
On 11/24/12 2:32 AM, John E. Malmberg wrote: The execute_cmd.c module uses make_command_string() as a parameter to the savestring() macro. This causes the savestring() macro to call that function twice(). Thanks, good catch. I made the same temporary variable fix you did. I have not done

Re: fd leak with {fd}

2012-11-26 Thread Chet Ramey
On 11/26/12 12:11 PM, Sam Liddicott wrote: I explained how in the lines of my response that you deleted. It is potentially useless because: 1. it is non-obvious, most users will not expect this behaviour (unless already initiated into the secret) and so will not try to get that benefit.

Re: Any chance of multi-dimensional arrays?

2012-11-26 Thread Chet Ramey
On 11/25/12 12:33 AM, Rene Herman wrote: Good day. I know that bash arrays are 1 dimensional -- but are there any plans for providing multi-dimensional arrays? I don't have any current plans to do so. I would take a look at any contributed code to add them, though. Chet -- ``The lyf so

Re: RFE: read -d STRING

2012-11-26 Thread Chet Ramey
On 11/23/12 7:40 PM, Chris F.A. Johnson wrote: I would find it very useful to allow a string of delimiters to be used with 'read -d', with any member of the string terminating the input and the character used being stored in a variable, e.g. READ_DELIM. Yes, this is still on the

Re: fd leak with {fd}

2012-11-26 Thread Chris F.A. Johnson
On Mon, 26 Nov 2012, Chet Ramey wrote: ,,, There have been unsuccessful new features -- the case-modifying expansions are one example of a swing and miss. A miss? I use them a lot. -- Chris F.A. Johnson, http://cfajohnson.com/ Author: Pro Bash Programming: Scripting the GNU/Linux

Re: fd leak with {fd}

2012-11-26 Thread Dennis Williamson
On Nov 26, 2012 2:48 PM, Chet Ramey chet.ra...@case.edu wrote: On 11/26/12 12:11 PM, Sam Liddicott wrote: I explained how in the lines of my response that you deleted. It is potentially useless because: 1. it is non-obvious, most users will not expect this behaviour (unless already

How to initialize a read-only, global, associative array in Bash?

2012-11-26 Thread Tim Friske
Hi folks, I execute the following code in Bash version GNU bash, Version 4.2.39(1)-release (x86_64-redhat-linux-gnu): function foobar { declare -rgA FOOBAR=([foo]=bar) } foobar declare -p FOOBAR # Output: declare -Ar FOOBAR='()' Why doesn't Bash initialize FOOBAR with ([foo]=bar) according to

Re: fd leak with {fd}

2012-11-26 Thread Chet Ramey
On 11/26/12 6:30 PM, Dennis Williamson wrote: Case modification in Bash is a highly viewed and highly upvoted question on Stack Overflow. Wow. I stand corrected. I had the impression it did not get very much use based on the discussion -- or lack thereof -- here and on help-bash. Chet --

Re: Any chance of multi-dimensional arrays?

2012-11-26 Thread Rene Herman
On 11/26/2012 11:27 PM, Chet Ramey wrote: I know that bash arrays are 1 dimensional -- but are there any plans for providing multi-dimensional arrays? I don't have any current plans to do so. I would take a look at any contributed code to add them, though. Thanks for the reply. It's fairly

Re: fd leak with {fd}

2012-11-26 Thread Pierre Gaston
On Mon, Nov 26, 2012 at 10:48 PM, Chet Ramey chet.ra...@case.edu wrote: On 11/26/12 12:11 PM, Sam Liddicott wrote: 3. there already exists simple and explicit way to get the supposed benefit using the existing mechanism exec Not quite. You still have to pick the file descriptor you want