I am experimenting with printf formatting in bash and I ran across this piece of code:
#/bin/bash
divider===============================
divider=$divider$divider
header="\n %-15s %8s %10s %11s\n"
format=" %-15s %08d %10s %11.2f\n"
width=55
printf "$header" "ITEM NAME" "ITEM ID" "COLOR" "PRICE"
printf "%$width.${width}s\n" "$divider"
printf "$format" \
Triangle 13 red 20 \
Oval 204449 "dark blue" 65.656 \
Square 3145 orange .7
The line that I am interested in is the line that says:
printf "%$width.${width}s\n" "$divider"
What is that variable reference doing? What does it mean?
Aucun commentaire:
Enregistrer un commentaire