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

Re: bash manual/info lacks examples



On Thu, Aug 05, 1999 at 10:10:30AM +0200, Andreas Tille wrote:
> On Thu, 5 Aug 1999, Mirek Kwasniak wrote:
> 
> > 1) For builtins bash has also help:
> >  
> >    $ help let | less
> > 
> > 2) Usage of man (my pager is `less')
> > 
> > 
> > 3) Usage of info
> Please don't understand me wrong.  I *found* the text where
> the description of let is documented.  But what do I have to
> type if I want to increase a shell variable?  The syntax of
> "arithmetic expression" remains unclear and an example, how
> to do
> 
>   a = $b + $c * $d
> and
>   a = ($b + $c) * $d
> 
> (because this demonstrates also braces in expresions which might
>  be misinterpreted by the shell) would be really helpful.
> 
> 

bash shells can do:

let a=$b+$c*$d
let a=($b+$c)*$d

but if you want to ensure compatibility with Bourne shells like
ash,  you should stick to:

a=$(($b+$c*$d))
a=$((($b+$c)*$d))

HTH,
Mike

[Private mail welcome, but no need to CC: me on list replies.]

hehe... the random sig hits again!

--
Michael Merten
          ---> E-Mail: mikemerten@yahoo.com
          ---> NRA Life Member -- http://www.nra.org
          ---> Debian GNU/Linux Fan -- http://www.debian.org
          ---> CenLA-LUG Founder -- http://www.angelfire.com/la2/cenlalug
--
It's great to be smart 'cause then you know stuff.


Reply to: