[kwlug-disc] fish vs bash: a progress bar from YSAP and some timing measurements

Ron ron at bclug.ca
Mon Aug 25 15:54:44 EDT 2025


William already answered this, but I found a couple unsent messages 
ready to go, so I'll press send anyway since it may help illuminate the 
issue.


Ron wrote on 2025-08-23 21:33:

>> For comparison, it would go like this in Bash...
>> 
>> echo " $i/$#: \$$i: ${!i} (or \$arg: $arg)"
> 
> I've never used the ${!i} syntax in bash, although I've seen it.
> 
> 
> What does that do?
Okay, someone pointed me to ChatGPT's answer:

https://chatgpt.com/share/68aaadf7-8f70-800f-aef1-404458c64b5c

prefix="abc"

abc1=foo
abc2=bar

echo ${!prefix*}   # → abc1 abc2
echo ${!prefix@}   # → abc1 abc2



foo=bar
bar=hello
var=foo
echo ${!var}   # prints "bar"
echo ${!foo}   # prints "hello"


abc1=hi
abc2=there
abcd=world
xyz=test

echo ${!abc*}
# prints "abc1 abc2 abcd"


(Ron says this, not ChatGPT: "Then, there's the usual nonsense about 
quoting") :



${!myvar*} → expands to all variable names that start with the contents 
of myvar.

${!myvar@} → does the same, but when quoted ("${!myvar@}"), it splits 
them into separate words, while * keeps them as one word.



More information about the kwlug-disc mailing list