0

If I execute below command, it will work fine:

$ echo BL{1..10};
BL1 BL2 BL3 BL4 BL5 BL6 BL7 BL8 BL9 BL10

But if assign 1 and 10 to a variable it won't work:

$ a=1;
$ b=10;
$ echo BL{$a..$b}
BL{1..10}

here how can I get output like "BL1 BL2 BL3 BL4 BL5 BL6 BL7 BL8 BL9 BL10"

Could any of you please help me.

Thanks in advance.

Br, Ranjith

  • *"echo {$var1..$var2} is not working in shell"* Any particular shell? bash? csh? sh? – T.J. Crowder Jan 18 '16 at 12:04
  • If you use Bash, it does brace expansion before variable expansion, see http://tldp.org/LDP/Bash-Beginners-Guide/html/sect_03_04.html. You can use `seq` command: `seq -f "BL%g" -s ' ' -t '\n' $a $b` – Yous Jan 18 '16 at 14:17
  • @T.J. Crowder: Thanks fir the information. It worked fine. – ranjith h l Jan 21 '16 at 09:24

0 Answers0