要在终端里打印一条分隔线,这条分隔线由”#“组成,宽度与终端的宽度相同。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?字符串