Brace expansion with variables and arrays: eval to the rescue

Posted by Bob_Mesibov on Apr 22, 2020 3:59 AM EDT
BASHing data
Mail this story
Print this story

In a 2019 blog post I tinkered with two alternatives to BASH brace expansion. Alternatives might be needed because strings with spaces cause problems unless separately quoted, and (I thought) you can't put shell variables inside the braces because BASH does brace expansion first when executing a command. But with the help of eval, a BASH built-in, you can brace-expand variables with ease, and a simple conversion lets you brace-expand BASH arrays.

Full Story

  Nav
» Read more about: Story Type: Tutorial; Groups: Linux

« Return to the newswire homepage

This topic does not have any threads posted yet!

You cannot post until you login.