我如何使用 echo
做到这一点?
perl -E 'say "=" x 100'
最佳答案
您可以使用:
printf '=%.0s' {1..100}
这是如何工作的:
Bash 扩展 {1..100}
所以命令变成:
printf '=%.0s' 1 2 3 4 ... 100
我已将 printf 的格式设置为 =%.0s
,这意味着无论给定什么参数,它都将始终打印一个 =
。因此它打印 100 =
s。
关于bash - 如何在 Bash 中重复一个字符?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5349718/