On Fri, 19 Apr 2002, at 1:36pm, [EMAIL PROTECTED] wrote:
> What's with the 'let' keyword?  I've seen it before, but I find it's use
> so rare that I just realized I don't really understand it's proper use?

  It forces airthmatic evaluation, similar to $((...)) and the 'eval'
command.  These all print the same thing:

        expr 5 + 5

        echo $(( 5 + 5 ))

        let foo='5 + 5'
        echo $foo

  AFAIK, which one is "better" depends on context, portability, and personal
taste.  :)

> Ben, since you're advocating the use of the $(...) construct, why didn't
> you take it further and provide an example ...

  I did:

>         let due=10#$(date +%j -d 04/01/2002)

  Or did you mean an example of nesting?  Um, pretty straight-forward:

        FOO=$(expr $(date +%j) + 5)

which would set 'FOO' to the day-of-the-year plus five.  (That is a really
contrived and stupid example, but I can't think of anything better right
now.)

> Just curious.  My shell programming isn't what it could be, since perl
> almost always has an easier and more efficient way of doing things :)

  Indeed.  But until/unless someone comes up with a workable Perl command
shell, it still comes in useful.  :-)

-- 
Ben Scott <[EMAIL PROTECTED]>
| The opinions expressed in this message are those of the author and do not |
| necessarily represent the views or policy of any other person, entity or  |
| organization.  All information is provided without warranty of any kind.  |







*****************************************************************
To unsubscribe from this list, send mail to [EMAIL PROTECTED]
with the text 'unsubscribe gnhlug' in the message body.
*****************************************************************

Reply via email to