Re: days difference between two dates

From: Alan Connor (xxxxxx_at_xxxx.xxx)
Date: 08/25/03

  • Next message: Troll: "Re: Dividing a string and appending/inserting its part"
    Date: Mon, 25 Aug 2003 16:41:40 GMT
    
    

    On Mon, 25 Aug 2003 16:51:41 +0200, Heiner Steven <heiner.steven@nexgo.de> wrote:
    >
    >
    > Edgar Allen wrote:
    >
    > > <html><input type crash></html>
    > > begin joe@invalid.address wrote:
    > >
    > >>If you come up with a link to ADU that works, please let me know and
    > >>I'll add it to the FAQ.
    > >
    > > Does the FAQ include ?
    > >
    > > Linkname: mktime - A command to manipulate time and date values
    > > URL: http://members.rogers.com/weirdways/technogeek/source/mktime/
    >
    > I think the answers our FAQ gives and the examples it provides
    > should try to be
    >
    > (1) shell only
    > one big advantage of shell scripts are that they run on
    > different platforms without need for compilation. This is
    > even more important in the light of Unices that
    > don't even have a C compiler as part of the standard
    > distribution, e.g. Sun's Solaris (what about AIX, HP-UX?)
    >
    > (2a) self contained
    > Solutions should not depend on other tools that need to
    > be installed separately. "awk", "sed", "expr" are examples
    > of tools that can be assumed to be installed, but a C compiler,
    > "python", or the program "netcat" cannot be.
    >
    > (2b) use POSIX conformant tools
    > The answers examples should not depend on non-portable,
    > non-standard functionality. For example, "find ... -print0"
    > is very useful, but it's a GNU extension that is not available
    > on e.g. Solaris (and probably AIX, HP-UX, too). In case of
    > doubt, the POSIX solution should be listed first, and then
    > other (e.g. GNU-specific) ones.
    >
    > (3) as portable as possible
    > Bourne shell solutions should be listed prior to
    > KornShell-specific ones.
    >
    > The portable
    >
    > base=`basename "$0"`
    >
    > should be listed in additon to a KornShell/BASH solution
    > like
    >
    > base=${0##*/}
    >
    > Although the latter example may be faster (and more elegant
    > in the eyes of some people), the former solution is much
    > more portable.
    >
    > (4) easily readable, even if not 100% correct
    > Sometimes scripts are easy to write, but it's hard to
    > make them 100% correct (e.g. handle new-lines in file names
    > or backslashes '\' in the input).
    > Since the FAQ is addressed to shell scripting beginners,
    > it's of paramount importance that the examples are easy to
    > understand. Therefore, a script example that works in
    > 95% of the cases and that is easy to read and understand should
    > be preferred to a script that is 100% correct but that is hard
    > to understand.
    > I don't say we should not give the 100% correct solution,
    > just that we present an easy, 90% solution, too.
    >
    > We cannot expect the readers of the FAQ to understand a
    > script line that we fine-tuned for years for correctness.
    > Give them a chance to find out how easily the shell
    > can be used to automate tasks. Don't confuse them with
    > perfect solutions they cannot understand, and therefore
    > cannot learn from.
    >
    > IMHO perfect solutions should be part of some shell
    > script library archive (e.g. something comparable to
    > Perl's CPAN).
    >
    > Regarding the "mktime" program: this program is useful
    > and maybe deserves a link in the FAQ, but IMHO should
    > not be listed as the "standard" solution to date arithmetic.
    >
    > Heiner

    I'm with you, Heiner.

    That "shell script library" sounds like a wonderful idea.

    Now, if I could only get a copy of that FAQ ......

    Alan C


  • Next message: Troll: "Re: Dividing a string and appending/inserting its part"

    Relevant Pages

    • Re: days difference between two dates
      ... I think the answers our FAQ gives and the examples it provides ... one big advantage of shell scripts are that they run on ... of tools that can be assumed to be installed, but a C compiler, ... be preferred to a script that is 100% correct but that is hard ...
      (comp.unix.shell)
    • comp.unix.shell FAQ take three
      ... This FAQ contains the answers to some Frequently Asked Questions ... It spells "unix" in lower case letters ... The other level is how to write shell scripts. ... How do I get a script to update my current environment? ...
      (comp.unix.shell)
    • Re: Problem with a conditional part of Makefile
      ... correct compiler requires the users to execute a shell script to alter ... I made a BASH build script that users *should* use to ...
      (comp.unix.programmer)
    • comp.unix.shell FAQ - Answers to Frequently Asked Questions
      ... This FAQ list contains the answers to some Frequently Asked Questions ... It spells "unix" in lower case letters ... The other level is how to write shell scripts. ... if the string being echoed wasn't built into the script ...
      (comp.unix.shell)
    • comp.unix.shell FAQ - Answers to Frequently Asked Questions
      ... This FAQ list contains the answers to some Frequently Asked Questions ... It spells "unix" in lower case letters ... The other level is how to write shell scripts. ... if the string being echoed wasn't built into the script ...
      (comp.unix.shell)