Customizing the Unix Shell
The UNIX shell is a actually a user program that the kernel runs for you when you log in. There is usually more than one shell available >on most UNIX systems. The most common shells available on UNIX systems are the Bourne Shell (sh), the C Shell (csh) and the Korn shell (ksh). A summary of features available on these three shells are shown at the end of this article, adapted from the Hewlett Packard "Beginner's Guide to HPUX."
Choosing your shell
It is possible to invoke any available shell from within another shell. To start a new shell, you can simply type the name of the shell you want to run, ksh, csh, or sh.
It is also possible to set the default startup shell for all your future sessions. The default shell for your account is stored in the system database /etc/passwd, along with the other information about your account. To change your default shell, use the chsh command The cshs command requires one argument, the name of the shell you want as your default. To change tour default shell to the C shell, you could enter the command
chsh /bin/csh
On ISU's HP-UX system, the available shells are /bin/sh, /bin/posix/sh, and /bin/csh. The default shell for accounts is /bin/posix/sh, which is, for all practical purposes, the same as ksh.
Default file access permissions
Whenever you create a file or directory in a UNIX filesystem, the newly created file or directory is stamped with a default set of permissions. That default set of permissions is stored in a variable called the umask. You can change the value of umask to suit your preferences. To see the current value of the umask variable, enter the shell command:
umask
The umask is stored as an octal (base 8) number, that defines which permissions to deny. As you recall, three kinds of file permissions (read, write, and execute) are given for each of three classes of users (owner, group, and others). Each of the nine permissions is specified as a zero (allow access), or a one (deny access).
To set your umask to deny write permission to group and others, use the command
umask 022
To deny all access to group and others, use the command
umask 077
Some versions of UNIX provide a more user-friendly way of specifying your umask. In HP-UX sh-posix (or ksh), you are allowed to specify the access permissions in manner of the chmod command. The command
mask u=rwx,g=r,o=r
would set the umask to deny write and execute permissions to the group, and to others. That kind of command syntax will not work in HP-UX's C shell or Bourne shell. The HP-UX posix shell also allows the use of the command
umask -S
to print your umask setting in a more readable fashion.
Feature | Function | sh | csh | ksh |
---|---|---|---|---|
Job control | Allows processes to be run in the background | No | Yes | Yes |
History substitution | Allows previous commands to be saved, edited, and reused | No | Yes | Yes |
File name completion | Allows automatic completion of partially typed file name | No | Yes | Yes |
Command line editing | Allows the use of an editor to modify the command line text | No | No | Yes |
Command aliasing | Allows the user to rename commands | No | Yes | Yes |
Loading Comments ...
Comments
No comments have been added for this post.
You must be logged in to make a comment.