-2

How to output one number few times with spaces in one line via bash

I have

a=5
b=10

I should output 5 times number 10 with using of variables and with spaces Also, i should capture this in variable

For example, i have to receive this

10 10 10 10 10

And it should be variable, it can be array. But after echo $c, i should receive 10 10 10 10 10

How to do it ?

Piduna
  • 541
  • 4
  • 12
  • 25

1 Answers1

2
for ((i=1;i<=a;i++)); do export c=$c" ${b}"; done; echo $c
10 10 10 10 10
Bob Dole
  • 96
  • 3