摘要: linux shell 中实现进度条: #! /bin/bash total_steps=100 for ((step=1; step<=total_steps; step++)); do printf "\r[%-50s] %d%%" $(printf "#%.0s" $(seq 1 $((ste 阅读全文
posted @ 2024-02-27 11:53 小鲨鱼2018 阅读(535) 评论(0) 推荐(0)
摘要: linux 中 printf "\r" 选项的作用 使用printf "\r"将光标移动到当前行的开头,用新文本覆盖掉同一行之前的文本内容。 阅读全文
posted @ 2024-02-27 11:24 小鲨鱼2018 阅读(108) 评论(0) 推荐(0)
摘要: 001、设置占位长度 [root@pc1 test1]# printf "%s\n" "abc" ## 一般输出 abc [root@pc1 test1]# printf "%20s\n" "abc" ## 设置占位长度20,默认情况下是右对齐 abc [root@pc1 test1]# print 阅读全文
posted @ 2024-02-27 10:04 小鲨鱼2018 阅读(113) 评论(0) 推荐(0)