bash question: command substitution is eating my arrays!

Karl Auer kauer at biplane.com.au
Sun Oct 27 17:43:02 UTC 2019


On Mon, 2019-10-28 at 03:57 +1100, Karl Auer wrote:
> The script below displays some (for me) surprising behaviour.

I've done a bit more research on this and come to the conclusion that
while it is not actually impossible, the available solutions in bash
are complicated and mostly unreadable.

Please don't waste your time on this issue, I apologise for bringing it
up.

My solution was to move the caching logic into my main loop, and only
do the expensive query in a separate function. It's not as nice as
hiding the cache and the query in one function, but it is not too bad,
quite readable, and it works well. My script run time has dropped by
80%, so I'm happy :-)

Regards, K.

-- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Karl Auer (kauer at biplane.com.au)
http://www.biplane.com.au/kauer
http://twitter.com/kauer389

GPG fingerprint: 8D08 9CAA 649A AFEF E862 062A 2E97 42D4 A2A0 616D
Old fingerprint: A0CD 28F0 10BE FC21 C57C 67C1 19A6 83A4 9B0B 1D75






More information about the ubuntu-users mailing list