On Thu, Aug 05, 1999 at 08:49:31AM +0200, Andreas Tille wrote: > Hello, > > every time I read the bash manual to get help I'm missing > examples for the basic usage of a builtin. For instance > I managed to write a simple shell script with a loop which > increased a variable > > i = 0; > while [ $i -lt $MAX ] ; do > echo $i > let ... > done > > But I havn't my small loop script handy this time and wanted > to know the syntax of let using `man bash` or `info bash`. > I'm I stupid or what is the reason that I can't find out, how > this expression after let has to be formed?
1) For builtins bash has also help: $ help let | less 2) Usage of man (my pager is `less') $ man bash /\<let\> n n and I see let arg [arg ...] Each arg is an arithmetic expression to be evaluĀ ated (see ARITHMETIC EVALUATION). If the last arg evaluates to 0, let returns 1; 0 is returned otherĀ wise. I go to top of manpage and issue new search: < /ARITHMETIC EVALUATION and see detailed description. 3) Usage of info $ info bash ^s let ^ ^ ^---^------------------ here arre spaces ^s and I see `let' let EXPRESSION [EXPRESSION] The `let' builtin allows arithmetic to be performed on shell variables. Each EXPRESSION is evaluated according to the rules given below in *Note Shell Arithmetic::. If the last EXPRESSION evaluates to 0, `let' returns 1; otherwise 0 is returned. after that I go to topic "Shell Arithmetic". Regards Mirek