Re: /bin/sh arithmetic doesn't seem to like leading 0 now

看板FB_stable作者時間13年前 (2012/09/24 02:01), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串8/8 (看更多)
On Fri, Sep 21, 2012 at 10:26:37PM +0000, David O'Brien wrote: > On Fri, Sep 21, 2012 at 07:34:06PM +0200, Jilles Tjoelker wrote: > > On Fri, Sep 21, 2012 at 10:09:02AM -0700, David Wolfskill wrote: > > > $ echo $(( ( $( date +%m ) - 1 ) / 3 + 1 )) > > > arithmetic expression: expecting ')': " ( 09 - 1 ) / 3 + 1 " > ... > > This was done to avoid an inconsistency where constants starting with > > "0" and containing "8" or "9" were decimal, so something like > > $((018-017)) expanded to 3. > Jilles, > Would it be possible to improve on the error message? > If David had been given the Bash error message, I suspect he would have > figured out the issue right away. It would certainly be possible to add a new error message, but from the embedded point of view the extra code size may not be worth it (also considering that error messages can be enhanced in many other places as well). -- Jilles Tjoelker _______________________________________________ freebsd-stable@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-stable To unsubscribe, send any mail to "freebsd-stable-unsubscribe@freebsd.org"
文章代碼(AID): #1GNqvWMP (FB_stable)
討論串 (同標題文章)
文章代碼(AID): #1GNqvWMP (FB_stable)