Jump to content United States-English
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
More options
HP.com home
Shells: User's Guide: HP 9000 Computers > Chapter 1 Introduction to Shells

Changing Shells

» 

Technical documentation

Complete book in PDF
» Feedback
Content starts here

 » Table of Contents

 » Index

Determining Your Login Shell

Your system may already be configured with the shell you want to use. You can display the file name of the shell you entered when you logged in by typing:

$ echo $SHELL

The echo command displays the contents or value of a variable named SHELL. The SHELL variable contains the name of the file that contains the shell program that you are running. The system responds to your echo $SHELL command with something like the following:

/bin/posix/sh
$ _

In this case, it is /bin/posix/sh, the file that contains the code for the POSIX Shell. Table 1-2 “Shell File Names and Default Prompts” lists both the file name that displays for each shell and the default system prompt.

Table 1-2 Shell File Names and Default Prompts

Shell

File Name

Prompt

Bourne

/bin/sh

$

POSIX

/bin/posix/sh

$

Korn

/bin/ksh

$

Key

/usr/bin/keysh

$

C

/bin/csh

%

Restricted Bourne

/bin/rsh

$

Restricted Korn

/bin/rksh

$

 

Temporarily Changing Your Shell

Unless you are in a restricted shell, you can temporarily change your shell by using this command:

shell_name

where shell_name is the name of the shell (for example, /bin/sh, or /bin/ksh). Temporarily changing your shell lets you experiment in other shells. By typing the name of the shell you want to run, you invoke (enter) that shell, and the correct prompt is displayed. After experimenting in the new shell, return to your original shell by typing either exit or pressing CTRL-D.

The following example begins in the Bourne Shell, enters the Korn Shell, and returns to the Bourne Shell:

$ /bin/ksh                    Enter Korn Shell.
$ ps Execute the ps command.
PID TTY TIME COMMAND
6009 tty01 0:00 ksh Notice that both the Korn Shell and
5784 tty01 0:00 sh Bourne Shell processes are running.
6010 tty01 0:00 ps
$ exit Exit Korn Shell.
$ _ Bourne Shell returns.

Permanently Changing Your Shell

To permanently change your login shell (the default shell you get when you log in), use the chsh (change shell) command:

chsh username shell_path_name

where username is your user name and shell_path_name is the full path name (e.g., /bin/posix/sh) of the shell you want as your default. Table 1-2 “Shell File Names and Default Prompts” contains the full path name for each of the shells. After you use the chsh command, you must log out and log in again for the change to take effect. For example, if terry changes the default login shell to the Korn Shell, the command reads:

$ chsh terry /bin/ksh
$ _
Printable version
Privacy statement Using this site means you accept its terms Feedback to webmaster
© 1983-1991 Hewlett-Packard Development Company, L.P.