0

I am working on a progress bar, so I need to print several consecutive # characters. I am using Bash shell operation.

This is the case example:

$ a=20
$ printf "#%.0s" {1..a}
#$ printf "#%.0s" {1..$a}
#$ printf "#%.0s" {1.."$a"}
#$ printf "#%.0s" {1..20}
####################

Note that it is only generated one only #, except when using the direct 20 value in the command line. Invoking the a variable seems not to work.

I need to do this programmatically, because 20 could be any other number.

What am I missing? Something obvious/stupid?
Thanks you.

Tom Fenech
  • 72,334
  • 12
  • 107
  • 141
Sopalajo de Arrierez
  • 3,543
  • 4
  • 34
  • 52

0 Answers0