我有一個bash腳本顯示某些狀態的文本,如:上留下一些文字,右邊一些文字,在一行上,用BASH
Removed file "sandwich.txt". (1/2)
Removed file "fish.txt". (2/2)
我想有進步文本(1/2)
完全顯示在右側,一字排開與終端窗口的邊緣,例如:
Removed file "sandwich.txt". (1/2)
Removed file "fish.txt". (2/2)
我在right align/pad numbers in bash和right text align - bash試圖解決方案,但方案仍沒有似乎工作,只能做了一個大的白色空間,例如:
Removed file "sandwich.txt". (1/2)
Removed file "fish.txt". (2/2)
我該如何讓一些文字左對齊,並將一些文字右對齊?
「第二種解決方案並不總是將右列與終端右邊緣對齊」,這就是爲什麼第一個解決方案如此複雜。 – 2012-04-04 02:17:52
可能重複的[右對齊/填充數字在bash](http://stackoverflow.com/questions/994461/right-align-pad-numbers-in-bash) – 2012-04-04 02:33:20
不是重複;這個問題是關於與終端邊緣對齊的,而不僅僅是如何使用printf。 – ghoti 2012-04-04 03:19:10