Indiana Preview - Solaris

This is a discussion on Indiana Preview - Solaris ; I have a question regarding shell changes in Indiana. I'm still learning so go easy on me. I was informed when a script calls for /bin/sh it will actually get ksh93. So I'd just like to understand what the reason ...

+ Reply to Thread
Results 1 to 7 of 7

Thread: Indiana Preview

  1. Indiana Preview

    I have a question regarding shell changes in Indiana. I'm still learning
    so go easy on me. I was informed when a script calls for /bin/sh it will
    actually get ksh93. So I'd just like to understand what the reason is for
    doing that. What I mean is, from what I know if your script is for ksh-it
    should have /bin/ksh at the top, if its for sh-it should have /bin/sh at
    the top. Why would you want to give a script ksh when its calling for sh?
    Or why would you make a new shell and use another shells name for it? Can
    someone straighten me out?

  2. Re: Indiana Preview

    On Tue, 26 Feb 2008 18:21:32 +0000, Andrew Gabriel wrote:

    > In article ,
    > brian writes:
    >> I have a question regarding shell changes in Indiana. I'm still learning
    >> so go easy on me. I was informed when a script calls for /bin/sh it will
    >> actually get ksh93. So I'd just like to understand what the reason is for
    >> doing that. What I mean is, from what I know if your script is for ksh-it
    >> should have /bin/ksh at the top, if its for sh-it should have /bin/sh at
    >> the top. Why would you want to give a script ksh when its calling for sh?
    >> Or why would you make a new shell and use another shells name for it? Can
    >> someone straighten me out?

    >
    > ksh is backwards compatible with borne shell, at least almost.
    > Indiana is an experiment, and one aspect of that is to try and
    > find what if anything might break if /bin/sh is changed to be
    > the more modern ksh. Has it caused you any problem?


    No, it hasn't. I mostly just want to understand the background reason for
    it. Why you would pretend ksh to be sh and not just set roots default
    shell to ksh if you weren't happy with the shortcomings on sh, and what
    would a script be asking for sh if it needed something else.

  3. Re: Indiana Preview

    On Tue, 26 Feb 2008, brian wrote:

    > No, it hasn't. I mostly just want to understand the background reason for
    > it. Why you would pretend ksh to be sh and not just set roots default
    > shell to ksh if you weren't happy with the shortcomings on sh, and what
    > would a script be asking for sh if it needed something else.


    You can thank our friends in Linux-land for that (calling something that
    isn't sh /bin/sh). They do the same thing with vi and God knows what
    else.

    A lot of sloppy scripts expect a POSIX-compliant shell when they use /bin/sh
    (or worse, they expect /bin/sh to be bash). The Bourne shell isn't fully
    POSIX-compliant, so doing this can cause problems. Problems that would be
    easily solved by using the correct shebang.

    Does it show that I'm not a fan of Indiana or the amount of influence it
    has over the OpenSolaris project? ;-)

    --
    Rich Teer, SCSA, SCNA, SCSECA, OGB member

    CEO,
    My Online Home Inventory

    URLs: http://www.rite-group.com/rich
    http://www.linkedin.com/in/richteer
    http://www.myonlinehomeinventory.com

  4. Re: Indiana Preview

    On 2008-02-27 15:18:32 +0000, Rich Teer said:

    > The Bourne shell isn't fully
    > POSIX-compliant


    Does POSIX require that /bin/sh be POSIX-compliant?

    Cheers,

    Chris


  5. Re: Indiana Preview


    "Andrew Gabriel" wrote in message
    news:47c458ac$0$507$5a6aecb4@news.aaisp.net.uk...
    > In article ,
    > brian writes:
    >> I have a question regarding shell changes in Indiana. I'm still learning
    >> so go easy on me. I was informed when a script calls for /bin/sh it will
    >> actually get ksh93. So I'd just like to understand what the reason is for
    >> doing that. What I mean is, from what I know if your script is for
    >> ksh-it
    >> should have /bin/ksh at the top, if its for sh-it should have /bin/sh at
    >> the top. Why would you want to give a script ksh when its calling for
    >> sh?
    >> Or why would you make a new shell and use another shells name for it?
    >> Can
    >> someone straighten me out?

    >
    > ksh is backwards compatible with borne shell, at least almost.
    > Indiana is an experiment, and one aspect of that is to try and
    > find what if anything might break if /bin/sh is changed to be
    > the more modern ksh. Has it caused you any problem?
    >
    > --
    > Andrew Gabriel
    > [email address is not usable -- followup in the newsgroup]


    I suspect very little would break. The option of #!/bin/sh will still be
    there.

    I for one welcome the change. I started with csh, liked it but found fewer
    and fewer were using it. Then did sh, but found I liked ksh better. With
    business most were using ksh so I have been ksh for over 10 years now.

    It might be an experiment, but giving root the ksh, and if they add a home
    directory for root it would be welcome in my books.



  6. Re: Indiana Preview

    On Wed, 27 Feb 2008, Chris Ridd wrote:

    > On 2008-02-27 15:18:32 +0000, Rich Teer said:
    >
    > > The Bourne shell isn't fully
    > > POSIX-compliant

    >
    > Does POSIX require that /bin/sh be POSIX-compliant?


    Nope. However, POSIX does require that the first executable
    occurance of sh in the directory path list returned by the
    command "getconf PATH" be POSIX-compliant.

    On Nevada build 81, this gives:

    rich@orac357# getconf PATH
    /usr/xpg4/bin:/usr/ccs/bin:/usr/bin:/opt/SUNWspro/bin

    So, the sh that is found in /usr/xpg4/bin must be POSIX-compliant,
    which it is.

    --
    Rich Teer, SCSA, SCNA, SCSECA, OGB member

    CEO,
    My Online Home Inventory

    URLs: http://www.rite-group.com/rich
    http://www.linkedin.com/in/richteer
    http://www.myonlinehomeinventory.com

  7. Re: Indiana Preview

    On 2008-02-28 03:20:47 +0000, Rich Teer said:

    > On Wed, 27 Feb 2008, Chris Ridd wrote:
    >
    >> On 2008-02-27 15:18:32 +0000, Rich Teer said:
    >>
    >>> The Bourne shell isn't fully
    >>> POSIX-compliant

    >>
    >> Does POSIX require that /bin/sh be POSIX-compliant?

    >
    > Nope. However, POSIX does require that the first executable
    > occurance of sh in the directory path list returned by the
    > command "getconf PATH" be POSIX-compliant.


    Thanks. I'll have to investigate getconf a bit more, that's not a
    command I've really used.

    How would one portably write a #! line in a shell script so that the
    script gets run in a POSIX shell?

    > On Nevada build 81, this gives:
    >
    > rich@orac357# getconf PATH
    > /usr/xpg4/bin:/usr/ccs/bin:/usr/bin:/opt/SUNWspro/bin
    >
    > So, the sh that is found in /usr/xpg4/bin must be POSIX-compliant,
    > which it is.


    On 10u I get exactly the same path.

    Cheers,

    Chris


+ Reply to Thread