BASH打印指定数量字符

repete print

printf "=%0.s" {1..20}

num=`printf "=%0.s" {1..20}`

echo -e "\n${#num}\n"

repete print number as a variable

num=30

eval printf "=%0.s" {1..${num}}

str=`eval printf "=%0.s" {1..${num}}`

echo -e "\nthe length of str is ${#str}"

posted @ 2021-04-12 22:22  MOVIT  阅读(225)  评论(1)    收藏  举报