Re: So that's what they're for.

From: Tim Haynes (usenet-20031128_at_stirfried.vegetable.org.uk)
Date: 11/28/03

  • Next message: Stephane CHAZELAS: "Re: So that's what they're for."
    Date: Fri, 28 Nov 2003 11:28:40 +0000
    
    

    "Chris F.A. Johnson" <c.fa.johnson@rogers.com> writes:

    > First, don't call external commands when there are internal
    > commands or syntax to accomplish the same thing. E.g.:
    >
    > NEWSIG=$(( $RANDOM * $NUMSIGS / 32767 ))

    Of course, this might not be readily portable to all shells the user wants.
    `expr' and/or `bc' might be worthwhile playing with.

    > Second, when external commands are necessary, don't call more
    > of them than absolutely necessary:
    >
    > NUMSIGS=`grep ^# ~/.siglist | wc -l`

    Says you, when you could've suggested

     NUMSIGS=$(grep -c "^#" ~/.siglist)

    instead ;8)

    ~Tim

    -- 
    No more sun, No more wind                   |piglet@stirfried.vegetable.org.uk
    Only this strange feeling                   |http://spodzone.org.uk/cesspit/
    Living without moving                       |
    

  • Next message: Stephane CHAZELAS: "Re: So that's what they're for."

    Relevant Pages

    • Re: More beginner help needed
      ... You are confusing syntax with semantics. ... There must be 10 useful ways to accomplish ... They have the same semantic choices available to them as I do. ... Obviously higher numbers are more logging! ...
      (comp.os.linux.misc)
    • Re: syntax for dict
      ... which commands need to know about the syntax though? ... incr mydict|key| ... I like this particular division of responsibilities as the duplication of commands (like [dict set],, etc) has always struck me as indicative of some underlying problem of factoring. ...
      (comp.lang.tcl)
    • Re: man page syntax for +script
      ... The man pages for and both describe how you can either replace the current script or append to it, but they give slightly different syntaxes. ... But the syntax for makes it appear that the + and the script are separate arguments, and that caused me some confusion. ... The plus is a semantic definition that these two unrelated commands put on their last argument, expr has a very different semantic definition of "+". ... you have a distorted view of what is syntax and what is semantics in Tcl. ...
      (comp.lang.tcl)
    • Re: Gforth execvp interface
      ... that does not support POSIX. ... to *commands*, as in a command-line interface to an operating system, ... which have more elaborate argument syntax. ... Since I have the freedom to define a word to store any string to hand ...
      (comp.lang.forth)
    • Re: Problem mit ksh und if
      ... Ich versuche mich weitestgehend an den Syntax der entsprechenden Shell ... Was halt bei bash und auch bei der ksh '[[' ... Warum sollte ich mir in einer Datei, die von nur zwei Shells beim Start ... Was interessieren mich da Standards oder andere Shells? ...
      (de.comp.os.unix.shell)