From: Brandon Casey Date: Fri, 17 Sep 2010 18:59:34 GMT Subject: Re: [PATCH] git-rebase--interactive.sh: LF terminate line sent to cut Message-ID: In-Reply-To: <7vsk182p2q.fsf@alter.siamese.dyndns.org> On 09/17/2010 01:38 PM, Junio C Hamano wrote: > Agreed; the less use of 'cut' we see, the better ;-) Double agreed. > As to portability guideline in our shell script: > > ${param#word} ${param##word} ${param%word} ${param%%word} > > are permissible POSIX constructs (together with more traditional -/=/?/+), and > their use is encouraged over 'cut', 'expr', etc. [*1*] > > ${param:ofs} ${param:ofs:len} ${param/pattern/string} > > are bashisms we avoid (unless of course in the bash completion script). It's been a long while since I've reviewed Documentation/CodingGuidelines, but these are indeed in there, and have been for a very long time. Maybe I should refresh my memory more often. :) > We do not seem to use ${#param}, not because it is forbidden, but I think > because it is not very useful without ${param:ofs:len}. CodingGuidelines does say "No strlen ${#parameter}", so that could be part of the reason. But like you say, it's not very useful without ${param:ofs:len}. -Brandon