X

Step Up to Modern Cloud Development

New Shell In Oracle Solaris 11

Guest Author

In Oracle Solaris 11, Korn Shell 93 (/usr/bin/ksh/ or usr/bin/ksh93) replaces both the Bourne Shell (/usr/bin/sh or /sbin/sh) and Korn Shell 88 (/usr/bin/ksh).

There are some incompatibilities between the shells. They are described in:

/usr/share/doc/ksh/COMPATIBILITY

If a script has compatibility problems you can use the legacy shell by changing the she-bang line:



If this doesn't work

Use This

#!/bin/ksh#!/usr/sunos/bin/ksh
#!/usr/bin/ksh#!/usr/sunos/bin/ksh
  
#!/bin/sh#!/usr/sunos/bin/sh
#!/usr/bin/sh#!/usr/sunos/bin/sh
#!/sbin/sh#!/usr/sunos/bin/sh

- Mike Gerdts http://blogs.oracle.com/zoneszone/


Website

Newsletter

Facebook

Twitter

Join the discussion

Comments ( 5 )
  • Mike Gerdts Friday, November 18, 2011

    Thanks for posting this, even if it is without a William Hung reference. :)


  • Rick Ramsey Friday, November 18, 2011

    LOL. I couldn't bring myself to do it, Mike. I tried, but I couldn't!

    Rick


  • Jeff Blaine Friday, November 18, 2011

    It's not really clear from this -- are you saying /bin/sh on Solaris 11 either does not exist or is actually the Korn shell?


  • guest Monday, November 21, 2011

    Consider this:

    $ ls -ld /bin /sbin /usr/bin/sh /usr/bin/ksh* /usr/lib/isaexec /usr/bin/*/ksh* /usr/sbin/sh

    lrwxrwxrwx 1 root root 9 Aug 18 11:59 /bin -> ./usr/bin/

    lrwxrwxrwx 1 root root 10 Aug 18 11:59 /sbin -> ./usr/sbin/

    -r-xr-xr-x 4 root bin 9768 Jun 2 09:06 /usr/bin/amd64/ksh*

    -r-xr-xr-x 4 root bin 9768 Jun 2 09:06 /usr/bin/amd64/ksh93*

    -r-xr-xr-x 4 root bin 8168 Jun 2 09:06 /usr/bin/i86/ksh*

    -r-xr-xr-x 4 root bin 8168 Jun 2 09:06 /usr/bin/i86/ksh93*

    -r-xr-xr-x 40 root bin 8200 Jun 2 09:05 /usr/bin/ksh*

    -r-xr-xr-x 40 root bin 8200 Jun 2 09:05 /usr/bin/ksh93*

    lrwxrwxrwx 1 root root 9 Aug 18 11:59 /usr/bin/sh -> i86/ksh93*

    -r-xr-xr-x 40 root bin 8200 Jun 2 09:05 /usr/lib/isaexec*

    lrwxrwxrwx 1 root root 16 Aug 18 11:59 /usr/sbin/sh -> ../bin/i86/ksh93*

    That is saying:

    - /bin is now a link to /usr/bin, as it has been for a very long time.

    - /sbin is now a link to /usr/sbin - this is new in Solaris 11

    - There are 64-bit (amd64/ksh amd64/ksh93) and 32-bit (i86/ksh i86/ksh93) versions of the ksh and ksh93 executables.

    - /usr/bin/ksh is an isaexec(3C) wrapper to call the 32-bit or 64-bit version as needed. Note that since Solaris 11 only runs a 64-bit kernel, it will always select the 64-bit version.

    - /usr/bin/sh and /usr/sbin/sh are symbolic links to the 32-bit version of ksh93.

    - By virtue of the first bullet point above, /bin/sh is a symbolic link to the 32-bit version of ksh93.


  • guest Saturday, March 31, 2012

    Hey, to further clarify,

    is this only true for x86/AMD platform,

    or is it also true FOR SPARC


Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.Captcha

Recent Content