/bin/ksh vs /usr/xpg4/bin/sh

Ask a Question related to Sun Solaris, Design and Development.

  1. #1

    Default /bin/ksh vs /usr/xpg4/bin/sh

    Hi all,

    I have a couple of questions regarding /usr/xpg4/bin/sh and
    /bin/ksh. On Solaris 8 (and perhaps earlier releases I don't
    have to hand here), /usr/xpg4/bin/sh is a symbolic link to
    /bin/ksh, but on Solaris 9 it isn't. Is there any reason for
    this? Also, in S9 the files have different sizes, suggesting
    that they're no longer identical. If that's the case, what,
    in a nutshell, are the differences between the two?

    A side observation is that standard conforming apps now use
    /usr/xpg4/bin/sh instead of /bin/ksh, when using system or
    popen, as the man pages for those functions state.

    TIA,

    --
    Rich Teer, SCNA, SCSA

    President,
    Rite Online Inc.

    Voice: +1 (250) 979-1638
    URL: [url]http://www.rite-online.net[/url]

    Rich Teer Guest

  2. #2

    Default Re: /bin/ksh vs /usr/xpg4/bin/sh

    Rich Teer <rich.teer@rite-group.com> writes:
    > /usr/xpg4/bin/sh is a symbolic link to /bin/ksh, but on Solaris 9 it
    > isn't. Is there any reason for this?
    It's the same reason that Bash behaves differently if you invoke it as
    /bin/sh on GNU/Linux systems. Namely, in a few cases the POSIX
    standard requires behavior that the ksh developer thinks is bogus.
    This is briefly discussed in the ksh man page on Solaris 9.
    For example, on Solaris 9:

    Command Result in /bin/ksh Result in /usr/xpg4/bin/sh
    echo $((010+10)) 20 18
    [ 10 -le $((011)) ] true false

    It's not just Solaris 9, by the way. It also happens on Solaris 8
    after you install Sun patch 110662-06 or later. The POSIX-conformance
    bug hasn't been fixed on Solaris 7; dunno if it ever will be.

    /bin/bash conforms to POSIX here, so it agrees with /usr/xpg4/bin/sh.
    Paul Eggert Guest

  3. #3

    Default Re: /bin/ksh vs /usr/xpg4/bin/sh

    Rich Teer <rich.teer@rite-group.com> writes:
    > On Solaris 8 (and perhaps earlier releases I don't
    > have to hand here), /usr/xpg4/bin/sh is a symbolic link to
    > /bin/ksh, but on Solaris 9 it isn't.
    /usr/xpg4/bin/sh evaluates $((010)) to 8, /usr/bin/ksh
    to 10. $((8#10)) evaluates to 8 on both. See man ksh(1).
    /usr/xpg4/bin/sh is now part of SUNWcsu (core bundle),
    before it belonged to SUNWxcu4 (optional).


    Markus
    Markus Gyger Guest

  4. #4

    Default Re: /bin/ksh vs /usr/xpg4/bin/sh

    On 5 Aug 2003, Markus Gyger wrote:
    > /usr/xpg4/bin/sh evaluates $((010)) to 8, /usr/bin/ksh
    > to 10. $((8#10)) evaluates to 8 on both. See man ksh(1).
    > /usr/xpg4/bin/sh is now part of SUNWcsu (core bundle),
    > before it belonged to SUNWxcu4 (optional).
    Got it; thanks guys.

    --
    Rich Teer, SCNA, SCSA

    President,
    Rite Online Inc.

    Voice: +1 (250) 979-1638
    URL: [url]http://www.rite-online.net[/url]

    Rich Teer Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139