要在終端裏打印一條分隔線,這條分隔線由」#「組成,寬度與終端的寬度相同。ide
#!/bin/sh printf '#%.0s' {1..100}
#!/bin/sh tput cols
#!/bin/sh printf '#%.0s' $(seq $(tput cols)) # 可能你須要在結尾加上一個換行符,默認printf是不帶換行符的
WikiNotes/重複字符串
How can I repeat a character
How do I find the width & height of a terminal window?字符串