Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Justifying text output



Thorsten Kampe wrote:
> I wrote a little script[1] that compiles the main zsh config files. Is
> there any way to make the "[ ok ]"/"[ failed ]" messages on the right
> justified?

I'll add a third way, also compatible with ksh: using printf.

printf "${ltred}* ${white}%-60s [ ${ltred}failed${white} ]\n" "ERROR:    $file - file not readable"

They key bit is the '%-60s' in the format string which tells it to
print the string right justified with a width of 60 spaces.

Oliver



Messages sorted by: Reverse Date, Date, Thread, Author