The POSIX shell is the default shell for HP-UX users. Other shells are also available on HP-UX. Important shells and their corresponding executable files are listed in Table 9-1.
Name of Shell | Path to Shell File |
---|---|
POSIX shell | /usr/bin/sh |
Bourne shell | /usr/old/bin/sh |
Korn shell | /usr/bin/ksh |
C shell | /usr/bin/csh |
There are two other shells used in HP-UX. One of these is called the restricted shell ( /usr/bin/rsh ), which is used to provide restricted access to some users. The key shell ( /usr/bin/keysh ) is a context-sensitive shell that may be handy to use with HP terminals.
The capabilities of POSIX and other important shells available on HP-UX systems are presented in Table 9-2.
Feature | Description | POSIX | Bourne | Korn | C |
---|---|---|---|---|---|
History | Allows previous commands to be viewed and reused | Yes | No | Yes | Yes |
Line editing | Allows a command line to be edited | Yes | No | Yes | No |
File name completion | Enables the user to enter partial file names and complete these automatically by pressing certain keys | Yes | No | Yes | Yes |
Command aliases | Allows creating aliases for standard commands | Yes | No | Yes | Yes |
Job control | Allows for running jobs in background and moving jobs from background to foreground and vice versa | Yes | No | Yes | Yes |
In the rest of this chapter, you will learn more about some of the capabilities of the POSIX shell.
A subshell can be invoked inside a shell at any time by using the shell path as the command line. A subshell inherits all environment variables from the parent shell but doesn't inherit any shell variables . Sometimes a user may need to invoke a subshell to have a particular shell environment. The current shell also invokes subshells if required by a command. Shell scripts are usually executed in subshells. You can exit from a subshell using the exit command at any time.
The ulimit command is an intrinsic command of the POSIX shell and is used to limit user resources. If you specify the -a switch with this command, it lists current resource limits. A typical output of the command is as follows .
$ ulimit -a time(seconds) unlimited file(blocks) unlimited data(kbytes) 135168 stack(kbytes) 8192 memory(kbytes) unlimited coredump(blocks) 4194303 nofiles(descriptors) 256 $
This command is very useful if you want to specify a limit for resources. For example, if you don't want the shell to create a core file larger than 1024 blocks, you can use following command.
$ ulimit -c 1024 $ ulimit -a time(seconds) unlimited file(blocks) unlimited data(kbytes) 135168 stack(kbytes) 8192 memory(kbytes) unlimited coredump(blocks) 1024 nofiles(descriptors) 256 $
Top |