{"thread":{"id":"1912","subject":"uncommon shell code","startedAt":"2005-09-22T14:32:43Z","lastAt":"2005-09-23T09:00:20Z","messageCount":4,"participants":["Robert Watson","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"9114","messageId":"72499e3b05092207326abadd91@mail.gmail.com","threadId":"1912","inReplyTo":null,"subject":"uncommon shell code","fromName":"Robert Watson","fromEmail":"robert.oo.watson@gmail.com","sentAt":"2005-09-22T14:32:43Z","receivedAt":"2005-09-22T14:32:43Z","isPatch":false,"sender":{"key":"robert.oo.watson@gmail.com","avatar":null},"body":"Hi,\n\nI found the following shell code in git-tag.sh (and others):\n\nwhile case \"$#\" in 0) break ;; esac\ndo\n  ...\ndone\n\nWhy not use the straight forward code:\n\nwhile test \"$#\" -ne 0\ndo\n   ...\ndone\n\nAre there any functional difference between them?\n\nRobertoo\n"},{"id":"9141","messageId":"7vu0gclpyo.fsf@assigned-by-dhcp.cox.net","threadId":"1912","inReplyTo":"72499e3b05092207326abadd91@mail.gmail.com","subject":"Re: uncommon shell code","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-09-22T22:03:59Z","receivedAt":"2005-09-22T22:03:59Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Robert Watson <robert.oo.watson@gmail.com> writes:\n\n> I found the following shell code in git-tag.sh (and others):\n\nMy fault; see point 2. in this article:\n\n\thttp://marc.theaimsgroup.com/?l=git&m=112386506308820&w=2\n\nPlease either get used to it or wait until I decide to modernize\nthe scripts wholesale, whichever comes first.\n"},{"id":"9155","messageId":"72499e3b05092301322a145e52@mail.gmail.com","threadId":"1912","inReplyTo":"7vu0gclpyo.fsf@assigned-by-dhcp.cox.net","subject":"Re: uncommon shell code","fromName":"Robert Watson","fromEmail":"robert.oo.watson@gmail.com","sentAt":"2005-09-23T08:32:26Z","receivedAt":"2005-09-23T08:32:26Z","isPatch":false,"sender":{"key":"robert.oo.watson@gmail.com","avatar":null},"body":"On 9/22/05, Junio C Hamano <junkio@cox.net> wrote:\n> Robert Watson <robert.oo.watson@gmail.com> writes:\n>\n> > I found the following shell code in git-tag.sh (and others):\n>\n> My fault; see point 2. in this article:\n>\n>         http://marc.theaimsgroup.com/?l=git&m=112386506308820&w=2\n>\n> Please either get used to it or wait until I decide to modernize\n> the scripts wholesale, whichever comes first.\n>\n\nI see.  I thought I was old fashioned by sticking to test instead of\n[] (that is your point 1), but obviously I am not old enough ;)\n\nWell, it's fine now that I know what it is.  But it hurts readability,\nand probably it's a good idea to simplify it.  Any reasonable shell\nshould built-in test(1)?\n\nRobertoo\n"},{"id":"9157","messageId":"7vwtl8duqj.fsf@assigned-by-dhcp.cox.net","threadId":"1912","inReplyTo":"72499e3b05092301322a145e52@mail.gmail.com","subject":"Re: uncommon shell code","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-09-23T09:00:20Z","receivedAt":"2005-09-23T09:00:20Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Robert Watson <robert.oo.watson@gmail.com> writes:\n\n> Well, it's fine now that I know what it is.  But it hurts\n> readability, and probably it's a good idea to simplify it.\n\nI try to stay away from style discussion, but readability is\nalways relative and personal.  Things like 'while case $# in\n...\" is an idiom for some but not for others -- and I am\nincluded in the former group of people (unfortunately).  In any\ncase, 'while test $# != 0' is not too much of a simplification\nanyway.\n\n> Any reasonable shell should built-in test(1)?\n\nCorrect.  The idiom comes from performance issues -- lack of\nbuilt in test long ago -- and that issue is not relevant\nanymore.  But the pattern being an idiom for some still is.\n\nHaving said that, I do not feel too strong about enforcing _my_\nstyle.  I _do_ feel somewhat strong about consistency, so if\nsomebody wants to update them, without dropping the ball in the\nmiddle, it is very likely that I can be persuaded to take a\nseries of patches to modernize them.\n"}]}