On Sun, Jan 08, 2006 at 03:18:21PM -0300, Eike Lantzsch wrote: > Maybe I'm too daft to see it > > LENGTH=8 > while [ $LENGTH -gt 0 ] ; do > echo $HEXIP > let LENGTH=($LENGTH - 1) *( -- line 43 )* > HEXIP=$(echo $HEXIP | cut -c -$LENGTH) > done > } > > If I remove the () in line 43 the syntax error does not show up but does it > still work as intended? > > I would appreciate any hint. Thank you > > -- > Eike Lantzsch ZP6CGE > Casilla de Correo 1519 > Asuncion / Paraguay > Tel.: 595-21-578698 FAX: 595-21-578690
I'm not a bash-guru (assuming this script is interpreted by bash), but since parentheses are used to change the order of precedence, they are not needed in the above case. Why bash doesn't like them in the above case is probably because LENGTH=($LENGTH - 1) is an argument to the let and contains special characters, it needs to be quoted. I guess, that the idea above is to decrement LENGTH, so let LENGTH=$LENGTH-1 let "LENGTH = $LENGTH - 1" let "LENGTH = ($LENGTH - 1)" let LENGTH-=1 let "LENGTH -= 1" are all equivalent. Simo -- :r ~/.signature
signature.asc
Description: Digital signature