Question

This has been frustrating me for two days and it seems like it should be a very simple thing. I was just created an account on a Solaris machine. Sun OS 5.10 I believe.

The default is Bourne shell which I don't want. I did a cat /etc/shells which results in:

/bin/sh
/sbin/sh
/bin/ksh
/usr/bin/ksh

Looks like Korn shell is all I can use.

I created a .profile file and wrote:

export SHELL=/usr/bin/ksh

Then I did a env and it looks like /bin/sh is still listed as my shell. I logged off, logged back on and now I get:

-sh: SHELL=/usr/bin/ksh: is not an identifier

I've tried adding #!/usr/bin/ksh at the beginning of the .profile. That didn't work. I've tried adding a semicolon at the end of the export. That didn't work. I've tried: SHELL=/bin/ksh and that didn't work either.

My end goal is to get this environment to a point where I can operate productively. I'm used to BASH where I have tab-completions, up-arrow for history, etc and this Bourne shell doesn't have any of that and it frustrates me to no end.

I know this must be simple but all my Googling comes to no avail. Can someone help me?

Was it helpful?

Solution

/etc/shells is not a standard Solaris file, you probably shouldn't rely on its contents.

On the other hand, bash is part of the default Solaris 10 installation. It should already be present as /bin/bash (/usr/bin/bash actually but /bin is a symlink to /usr/bin anyway).

If bash is not there, you might want to ask to the administrator to install the SUNWbash package from the Solaris_10/Product directory in the installation media.

Then, to update your shell, the regular way is to have the shell defined for your account updated. If it is local, that's the last field in your /etc/passwd entry.

Alternatively, you might use that hack at the end of your .profile:

[ ! "$BASH_VERSION" -a -x /bin/bash ] && SHELL=/bin/bash exec /bin/bash 

OTHER TIPS

In descending order of preference

  1. ask the sysadmin to install bash and update /etc/shells and update your login shell
  2. see if the chsh program is installed that will allow you to change your own login shell
  3. ask the sysadmin to change your login shell to /usr/bin/ksh
  4. modify your ~/.profile:

    if type [[ >/dev/null; then
        : # this is ksh
    else
        # not ksh
        export SHELL; SHELL=/usr/bin/ksh
        exec $SHELL
    fi
    
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top