Back to the learning path

printf

printf = print formatted Command details
Step 1/1: Formatted output

printf FORMAT ARGS…: %s string, %d integer, %.2f two decimals, %-10s left-aligned in 10, %5d right-aligned in 5. Unlike echo it adds no newline; write \n yourself.

$ printf "%-10s|%5d\n" alice 42
Fundamentalsprintf
Formatted output
Use printf to print one line: frank left-aligned in 12 characters, then "|", then 766 right-aligned in 5 characters, then a newline.
unaliasNext lesson:expr