I would like to print data format like this in bash shell. Can you suggest how to print the numbers out?
Number= 1
Number= 10
Number= 100
Number= 1000
CodePudding user response:
Use printf
; it allows format strings, including padding:
for n in 1 10 100 1000; do
printf "Number=%6s\n" $n
done
Number= 1
Number= 10
Number= 100
Number= 1000