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

Re: PATCH: C_BASES option for outputting hex and octal



Peter Stephenson wrote:
>Does anyone object to my adding options for trivial things like this?
>Because if so they ought to have got the point and given up objecting years
>ago :-/.  (I finally got fed up with 0x${$(([#16]$num))##*\#}.)

Wouldn't it be nicer to have $(([#0x]$num)) do the 0x-prefixed output,
or some equivalent syntax?  It'd be nicer not to have to fiddle with a
global option to control an essentially local decision.

Hmm.  Perhaps a better way to do this kind of syntax would be to have a
flag to say "don't output a radix prefix", so you'd do "0x$(([#16-]$num))"
to get the 0x prefix.  This is more flexible too, there are plenty of
situations where you want non-decimal output without any standard prefix.

-zefram



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