How do I printf align my output as a table?
Title Author BaokyBook Baoky2 Use basename commandUse basename command .. Baoky
My partial code is like this
titlelength=${#title};
First I get the length of the header, then I print it as
titlespace=`expr 60 - titlelength`; printf "%s %${titlespace}s\n" "$title" "$author"
But the alignment is not correct, how can I make it work well aligned
In response to the answer below:
after making changes
all my left ones are aligned to the right. and it does not work.
source share