1

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?

noblerare
  • 10,277
  • 23
  • 78
  • 140
  • 1
    The ancient Bourne shell in Solaris does not support the modern `export FOO=bar` syntax, you must use the older `FOO=bar ; export FOO` style. – alanc Feb 28 '14 at 16:57

2 Answers2

1

/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 
jlliagre
  • 29,783
  • 6
  • 61
  • 72
  • I tried to navigate to `/usr/bin/bash` or `/bin/bash` and both don't exist. I'm going to take this to mean that I just don't have bash :( In any case, I looked up the `/etc/passwd` and am going to have my sysadmin update the shell that I have in my account to be `/bin/ksh` instead of `/bin/sh`. I'll keep you updated. – noblerare Feb 28 '14 at 14:43
  • What says `cat /etc/release` ? – jlliagre Feb 28 '14 at 17:38
  • @jliagre: Solaris 10 10/09 s10s_u8wos_08a – noblerare Mar 03 '14 at 14:33
  • That must be some kind of minimized installation. Answer updated – jlliagre Mar 03 '14 at 15:56
  • @jliagre, thanks, I'm going to accept your answer because even though bash isn't installed on my machine, the info about the `/etc/passwd` did help me change from `sh` to `ksh`. – noblerare Mar 04 '14 at 15:32
0

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
    
glenn jackman
  • 238,783
  • 38
  • 220
  • 352