On Monday, August 20, 2012 07:44:51 PM Roman Rakus wrote:
> And how would you achieve to fill array with all file names containing
> `[1]=' for example.
$ ls
[1]=a [1]=b
$ ( typeset -a a=( \[1\]=* ); typeset -p a )
typeset -a a=('[1]=a' '[1]=b')
$ ( typeset -a a=( [1]=* ); typeset -p a )
typeset -a a=([1]='*')
$
In ksh93, by escaping. I think this is what most people would expect and
probably what Bash intended.
Of course, In that shell in order to use "[n]="-style indexing each and every
element needs to be specified that way explicitly. I like that Bash can just
implicitly start counting at any index.
--
Dan Douglas