0

Is there a bash equivalent to python's elegant string multiplication?

>>> "=" * 8
'========'
OrenIshShalom
  • 5,974
  • 9
  • 37
  • 87
  • Does this answer your question? [How can I repeat a character in Bash?](https://stackoverflow.com/questions/5349718/how-can-i-repeat-a-character-in-bash) – 0stone0 Apr 21 '21 at 11:39

2 Answers2

5

You can use printf.

printf '=%.0s' {1..8}

Vikash Kumar
  • 177
  • 1
  • 9
0

you can try something like this:

myString=$(printf "%10s");echo ${myString// /=} 
Amit Nanaware
  • 3,203
  • 1
  • 6
  • 19