bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Severe Bash Bug with Arrays


From: Greg Wooledge
Subject: Re: Severe Bash Bug with Arrays
Date: Thu, 26 Apr 2012 14:16:06 -0400
User-agent: Mutt/1.4.2.3i

On Thu, Apr 26, 2012 at 05:54:27PM +0200, Maarten Billemont wrote:
> On 26 Apr 2012, at 01:18, Linda Walsh wrote:
> > 
> > Ishtar:> echo "${b[*]}"
> 
> You should always recommend the "${b[@]}" variant.  "${b[*]}" is rarely 
> useful in the event that your intent is to merge the array into a single 
> string, eg. for displaying elements to a user:
> dirs=(*/)
> (IFS=,; echo "The dirs are: ${dirs[*]}")
> 
> But anyway, that's an aside from this topic, which has very little to do with 
> this.

If the goal is to see the contents of an array, I'd use one of these,
depending on how much detail I need:

printf '<%s> ' "${array[@]}"; echo

declare -p array



reply via email to

[Prev in Thread] Current Thread [Next in Thread]