Twitter Updates

    follow me on Twitter

    G-AVLN in front of her home

    G-AVLN in front of her home

    Mostly Unix and Linux topics. But flying might get a mention too.

    Wednesday, October 17, 2007

    ksh93 - test, test and then test a bit more

    Since ksh93 is now [1] available for most version of UNIX (and Linux), we have been tentatively moving our courses (especially scripting) towards the new syntax. At the moment the scripting course is still based predominantly on the pre-93 versions, but we now introduce a fair amount of comparisons, 'gotchas' and demos of new capabilities and syntax.

    Truth is, months later we still find new idiosyncrasies.

    Here is one I found today, whilst teaching... Imagine the following example, to illustrate the need for double quotes when creating and accessing variables:

    If you want to assign a value that has leading or trailing spaces or tabs, you need the quotes:

    $ address=" 6 Pie Corner"

    Would you expect to see the leading spaces if you didn't use the quotes when accessing the variable? Of course not! Well, in ksh93 it works! Haven't checked yet if this behaviour is driven by any particular setting or switch, but in my CentOS 5 ksh (Version M 1993-12-28 r), the following worked out of the box:

    $ print -- $address

    <space><space>6 Pie Corner

    [1] in the original posting this said 'not' - corrected 18/10/2007


    Anonymous said...

    1. ksh93 is available on most Linux distributions, including SUSE and Debian
    2. ksh93 is available on Solaris:

    Alina said...

    That's correct. So does RedHat (hence Fedora and CentOS), and HP-UX, and AIX, indeed any version of UNIX that uses ksh either already provides the ksh93, or has the capability to add it.
    I wonder if I have missed the point of your comment...

    Anonymous said...

    I think he was wondering about the "not available" in your "Since ksh93 is not available"...
    AFAIK you were thinking about "now", not "not", right?

    Anonymous said...

    Did you read the ksh93 code style guide yet?

    Blog Archive