0

Lets say I write a command in unix bash:

[~/mm]$ ls log{1,2}

It matches 2 files:

log1  log2

But when I store the curly brackets in a variable:

[~/mm]$ x=log{1,2}

And execute this:

[~/mm]$ ls $x
ls: cannot access log{1,2}: No such file or directory

The log{1,2} are not expanded to log1 | log2, instead the exact file name is matched.

How can I run the command with evaluating the curly brackets in the variable?

Marek Mezei
  • 61
  • 1
  • 1
  • 4

0 Answers0