Re: Shell script cleanups/style changes?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Junio C Hamano <gitster@xxxxxxxxx> writes:

> 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
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux