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

Re: padding.



On 11/02/17 11:04 AM, Bart Schaefer wrote:
integer -Z 6 vvar=-1

Perfect! Amazing what's hiding under the hood. I always prefer to do as much as possible with built in functionality.
I don't think you can, except by specifying a field width of 6.  Even
printf is going to treat the "-" as part of the field width.

Yeah, it would be more complicated and more involved to get a neat printout. The engineer in me does want the field width to be independent of the sign, but it's a trivial matter.

BTW, is this kosher:


|$  if [ "$1" = "start" ]; then||
||        if [ "$1" = 'null' ] && return||
||   fi||
||
||(no message) and:||
||
||$  if [ "$1" = "start" ]; then||
||        # if [ "$1" = 'null' ] && return||
||   fi||
||
||(no message) but:||
||
||$  # if [ "$1" = "start" ]; then||
||        if [ "$1" = 'null' ] && return||
||   # fi||
||
||||./test2:7: parse error near `\n'||
|
... I just noticed this in some of my code. Seems to me that samples one and two above should throw an error because there are two 'fi' needed but they seem to be sharing the single one. And sample three gets it right, no?



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