[Top][All Lists]

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

feature request: apply parameter expansions to array keys

From: Ken Irving
Subject: feature request: apply parameter expansions to array keys
Date: Sun, 15 Dec 2013 16:40:45 -0900
User-agent: Mutt/1.5.20 (2009-06-14)

No bug here, but I naively expected the pattern substitution expansion
to work on array keys as well as values, e.g.:

    $ declare -A h
    $ h[foo]=x h[bar]=y
    $ # show keys and values:
    $ printf "\t<%s>\n" "address@hidden" "address@hidden"
    $ # try to pad keys and values:
    $ printf "\t<%s>\n" "address@hidden/#/    }" "address@hidden/#/  }"
        <  y>
        <  x>

I wanted to print out array keys with some padding, easily done in a loop,
but I wanted the padding applied to the separate strings generated using
the quoted address@hidden expansion.

The manpage documents the address@hidden 'List of arrays keys' expansion
separately from the pattern substitution expansion, so it's all working
as documented, but I think the syntax could allow this.

I'm not running the latest bash: 

    $ bash --version
    GNU bash, version 4.2.37(1)-release (i486-pc-linux-gnu)


reply via email to

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