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

Re: Justifying text output



* Oliver Kiddle (2004-03-12 12:28 +0100)
> 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.

Thanks. The key bit is to understand it, but I haven't found any
documentation about that (just a small one in the susv3. Are there any
explanations available (along with this "${(r:70:):-" and
"${(r.40.):-" stuff)?

Thorsten



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