[kwlug-disc] fish vs bash: a progress bar from YSAP and some timing measurements
William Park
opengeometry at yahoo.ca
Mon Aug 25 01:53:56 EDT 2025
On 2025-08-24 00:33, Ron wrote:
> I've never used the ${!i} syntax in bash, although I've seen it.
>
> What does that do?
Indirection. Eg.
set -- aa bb cc dd ee
i=2
echo $i ${!i}
> ${!prefix*}
> ${!prefix@}
> Names matching prefix. Expands to the names of variables whose
> names begin with prefix, separated by the first character of the
> IFS special variable. When @ is used and the expansion appears
> within double quotes, each variable name expands to a separate
> word.
>
> I actually don't understand what this is telling me.
It just returns list of variables whose name start with string 'prefix'.
Useful if you created abc001, abc002, abc003, ..., and want to go
through them. Eg.
a1=11 a2=22 a3=33 abc=44
echo ${!a*}
More information about the kwlug-disc
mailing list