## 1.4. Getting the 1993 Korn Shell

This book covers the 1993 version of the Korn shell. A large amount of what's covered is unique to that shell; a subset of what is unique applies only to the recent versions available directly from AT&T. In order to make best use of the book, you should be using the 1993 Korn shell. Use the following sequence of instructions to determine what shell you currently have and whether the 1993 Korn shell exists on your system, and to make the 1993 Korn shell be your login shell.

1. Determine which shell you are using. The `SHELL` variable denotes your login shell. Log in to your system and type `echo $SHELL` at the prompt. You will see a response containing `sh`, `csh`, or `ksh`; these denote the Bourne, C, and Korn shells, respectively. (There's also a good chance that you're using a third-party shell such as bash or tcsh.) If the response is `ksh`, go to step 3. Otherwise, continue to step 2.

2. See if some version of ksh exists on your system in a standard directory. Type `ksh`. If that works (prints a `$` prompt), you have a version of the Korn shell; proceed to step 3. Otherwise, proceed to step 5.

3. Check the version. Type `echo ${.sh.version}`. If that prints a version, you're all set; skip the rest of these instructions. Otherwise, continue to step 4.

4. You don't have the 1993 version of the Korn shell. To find out what version you do have, type the command `set -o emacs`, then press CTRL-V. This will tell you if you have the 1988 version or the Public Domain Korn shell. In either case, continue to step 5.

5. Type the command `/usr/dt/bin/dtksh`. If this gives you a `$` prompt, you have the Desktop Korn Shell, which is based on an early version of ksh93. You may use this version; almost everything in this book will work. Go to step 7.

6. You need to download an executable version of ksh93 or download the source and build an executable from it. These tasks are described in Appendix C. It would be best to enlist the help of your system administrator for this step. Once you have a working ksh93, continue to step 7.

7. Install ksh93 as your login shell. There are two situations; pick the one appropriate to you:

   Single-user system
     On a single-user system, where you are the administrator, you will probably need to add the full path to ksh93 to the file /etc/shells as the first step. Then, you should be able to change your login shell by typing `chsh` ``ksh-name``, where ksh-name is the full path to the ksh93 executable. If this works, you'll be prompted for your password. Type in your password, then log out and log back in again to start using the Korn shell.

     If chsh doesn't exist or doesn't work, check the man page for passwd(1). Look for either the -e or -s options for updating your password file information. Use whatever is appropriate for your system to change your login shell.

     If none of the above works, you can resort to editing the /etc/passwd file while logged in as `root`. If you have the vipw(8) command, you should use that to edit your password file. Otherwise, edit the file manually with your favorite text editor.

   Large multi-user system
     This situation is even more complex than the single-user case. It is best to let your system administrator handle changing the shell for you. Most large installations have a "helpdesk" (accessible via email or phone, or both) for entering such requests.

Copyright © 2003 O'Reilly & Associates. All rights reserved.