How can I fix the output width using printf
?
This is an example script:
#!/bin/bash
OK=$(printf '\t%+50s\n' OK)
FAIL=$(printf '\t%+50s\n' FAIL)
for i in a aa aaa aaaa aaaaaa aaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaa; do
echo "$i $OK"
done
Output:
a OK
aa OK
aaa OK
aaaa OK
aaaaaa OK
aaaaaaaaaaaaaaaaa OK
aaaaaaaaaaaaaaaaaaaaaaaaaa OK
I want something like:
a OK
aa OK
aaa OK
aaaa OK
aaaaaa OK
aaaaaaaaaaaaaaaaa OK
aaaaaaaaaaaaaaaaaaaaaaaaaa OK