Re: Shell script cleanups/style changes?
- From
David Kastrup <dak@gnu.org>
- Date
- Aug 2, 2007, 22:02 UTC
- Message-ID
- <85zm19y4qk.fsf@lola.goethe.zz>
- In-Reply-To
- <7vodhptyk3.fsf@assigned-by-dhcp.cox.net>
Junio C Hamano <gitster@pobox.com> writes:
Show 6 quoted lines
> You might find this thread amusing.
>
> http://thread.gmane.org/gmane.comp.version-control.git/7116/focus=7136
>
> Historically, I have even avoided accepting ${var#word}, ${var%word},
> and arithmetic expansions.I learnt Unix with a Banaham/Rutter primer in the early eighties. I got hit so often by the "this is now supposed to work in Bourne shells?" surprise it wasn't funny.
The first time I saw "for ((i=0; i<$NR; i++)) ..." I thought the author had been smoking too much C and got things confused. It still creeps me out. I am more comfortable doing arithmetic with dc rather than sh.
Employing the existing globbing machinery for # and %, on the other hand, seems quite bournesque (still-bourne sounds so ugly) to me. And it is certainly quite more readable than the regexp/expr stuff.
If it works.
-- David Kastrup, Kriemhildstr. 15, 44793 Bochum