Thread (1 message) 1 message, 1 author, 2016-06-15

Re: Shell script cleanups/style changes?

From: David Kastrup <hidden>
Date: 2016-06-15 22:43:25

Junio C Hamano [off-list ref] 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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help