0

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

>>> "=" * 8
'========'
OrenIshShalom
  • 4,294
  • 5
  • 22
  • 55
  • 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

4

You can use printf.

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

Vikash Kumar
  • 157
  • 8
0

you can try something like this:

myString=$(printf "%10s");echo ${myString// /=} 
Amit Nanaware
  • 2,974
  • 1
  • 5
  • 18