Shells

   


Shells

The shell is the means by which UNIX commands are executed, whether at the command line or from a file ”the latter is known as a shell script or program. The system startup (and shutdown) procedures execute a number of shell scripts. The shell is an interactive programming language as well as a command interpreter; it enables the user to set variables and customize the environment. Choosing which shell to use often comes down to personal preference ”you can use the one that you feel most comfortable with and that provides the functionality required.

This section identifies the shells that are available for use with the Solaris operating environment and discusses some of the differences between them. Entire books have been written on the use of the UNIX shells; some of these are referenced in the Appendix, "Resources." This section is intended only to identify and introduce the different shells.

Shells Bundled with the Solaris Environment

A number of shells actually are delivered with the Solaris operating environment, offering various features:

  • The Bourne shell (sh and jsh) ”This is the default shell and the only one that is always present in any version of UNIX. As the original UNIX shell, the Bourne shell is still used as the standard for system initialization scripts. Using the jsh option enables extra job control functionality, allowing jobs to be suspended or run as a background task, for example.

  • The C shell (csh) ”This shell is a Berkeley UNIX product. Its syntax resembles the C programming language much more than the Bourne shell. With SunOS 4. x based on BSD UNIX, the C shell was heavily used until SunOS 5. x , when Sun switched to System V-based UNIX. The C shell contained some extra features not present in the Bourne shell, including filename completion, in which a hot key could be pressed to instruct the shell to attempt to complete the name of the command or file being typed. Command aliases and command history were other functions available in this shell.

  • The Korn shell (ksh) ”The Korn shell has become the de facto standard for UNIX systems. It is now universally available and provides a far superior functionality than the Bourne shell. The Korn shell includes command-line editing, allowing the use of either vi- or Emacs-type editing syntax, command aliasing, filename completion, job control, and command history ”virtually everything that the system administrator would need.

Don't lose the root shell

The standard shell for the superuser (root) resides in /sbin/sh. The sbin directory contains statically linked programs ”that is, programs that already contain any library functions that might be required to execute the program. Therefore, they are self-sufficient, unlike dynamically linked programs that call library modules at runtime. Changing the default root shell to a dynamically linked shell might save a little bit of disk space, but it could also mean that the superuser cannot log on in case of a failure affecting the runtime libraries.


  • The desktop Korn shell (dtksh) ” This is a shell bundled with the Common Desktop Environment (CDE) software that provides an extended version of the Korn shell (ksh-93) with support for many X Window graphical functions. These functions were previously used in programs that required compilation and linking before they could run. The dtksh shell provides a very similar functionality that can run as a normal shell script ”that is, it is interpreted rather than compiled.

  • The restricted shell (rsh) ”This is a more controlled version of the Bourne shell, and it is used to restrict the access of a user. With this shell, the user cannot change a directory or set the PATH variable. There can be no redirection of output, nor can any absolute pathnames be specified (starting with "/"). The restricted shell command should not be confused with the remote shell. Both are called rsh (the remote shell is also referred to as remsh), but they reside in different directories: the restricted shell in /usr/lib and the remote shell in /usr/bin.

Shells Available in the Public Domain

A number of shells have been written and made available in the public domain. These are mainly extensions to the existing shells with additional functionality added. Although there are many, three of the more popular ones are discussed here:

  • Bash ”Bash, which stands for "Bourne Again Shell," is a public domain shell written by the Free Software Foundation. It is intended to be a full implementation of the IEEE shell and tools standard, and it is provided as the default shell on most versions of Linux.

    Bash is fully compatible with the Bourne shell ”Bourne shell scripts will run without modification under the Bash shell. It also incorporates useful features of the Korn shell (ksh) and the C shell (csh).

    In addition, Bash offers command-line editing without having to erase back to the point of error. Vi- or Emacs-style editing commands can be used, and Bash includes a command history feature as well as filename completion and a built-in help facility. This is by far the most popular of the public domain shells available.

  • tcsh ”This shell is an extended version of the Berkeley C shell. It is fully compatible with the C shell, but it includes additional functionality, such as a command-line editor, word completion, spelling correction, a command history recall mechanism, and built-in job control functions.

  • zsh ”This shell resembles most closely the Korn shell ” specifically , ksh-88. As with the other public domain shells, it is an enhanced version. zsh incorporates some of its functionality from tcsh and includes other features to try to make users of the C shell feel more at home when using it. The zsh shell is highly configurable and, like the others mentioned, includes additional functionality for such things as job control, spelling correction, filename completion, command history, and command-line editing. zsh also can accommodate multiline commands (even files), allowing them to be edited as a single buffer.

These three shells are now delivered as standard with Solaris 8. Their basic functionality is extremely similar, with job control, word completion, a command-line editor, and the capability to recall a history of previously entered commands being common to all of them.

The Secure Shell

The secure shell provides the means to access systems securely, using encrypted communications between a client and a Solaris system based on their own SSH secure protocol. The secure shell daemon runs on the Solaris system and will accept a login request only from a "known host" ”that is, a system with a registered encryption key. The secure shell is available from SSH Communications Security Corp. (http://www.ssh.com). This has become the de facto standard for users requiring remote logins.

Two versions of the secure protocol exist: SSH version 1 (SSH1) and SSH version 2 (SSH2). Both encrypt at different parts of the network packet. SSH2 uses only host keys to authenticate systems, whereas SSH1 uses server and host keys. The two protocols are incompatible, although they can both be run on the same system if SSH1 was installed before SSH2. The SSH2 protocol is a complete rewrite and is more secure. SSH2 also includes an easy-to-use secure file transfer facility, using the Secure File Transfer Protocol (SFTP).

Licensing of the two protocols has been a factor in deciding which one to use. SSH1 was originally free, although versions later than 1.2.12 apply restrictive licensing. A number of ISPs still work on SSH1 because it is free and has proven to be stable because it has been around longer. SSH2, on the other hand, is free only for nonprofit organizations, educational organizations, or entities using it purely for charity.

SSH is not only a shell, but it also provides a graphical environment when needed in a secure environment. The X Window System over SSH can be used when only secure connectivity is permitted.


   
Top


Solaris System Management
Solaris System Management (New Riders Professional Library)
ISBN: 073571018X
EAN: 2147483647
Year: 2001
Pages: 101
Authors: John Philcox

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net