3.1 The bash shell

 <  Day Day Up  >  

The most powerful and flexible administration tool on almost every UNIX-like system is the shell. The standard shell in a SuSE SLES for pSeries 8.0 is the Bourne again shell, or bash. It is an sh-compatible shell that incorporates useful features from the Korn shell (ksh) and C shell (csh). It is intended to conform to the IEEE POSIX P1003.2/ISO 9945.2 Shell and Tools standard. Most sh scripts can be run by bash without modification.

Command history

The standard history mode on bash is emacs; to view all of the current settings of the shell, issue the set -o command:

 # set -o 

If you are more comfortable using vi than the emacs mode, use the set -o vi command.

The default history size is 500 entries, but this can be changed by setting the HISTSIZE variable.

Command line history keys are mapped to the arrow keys by default. You can navigate the history by pressing arrow up and arrow down keys. Pressing Ctrl + R allows you to search in history; simply start typing your command and bash will display the first match in the history. You can then continue typing to get other results, or press Ctrl + R again to search backwards according to the characters already given.

Command completion

The bash shell provides command completion, so typing the first letters from a command and pressing the Tab key will give you the choices from all executables in your path .

 # cs TAB TAB csh     csplit 

Typing TAB TAB after the executable will show the files in the current directory:

 lpar5:/etc/sysconfig/network # vi TAB TAB config           ifcfg-eth0       ifcfg.template wireless dhcp             ifcfg-eth0.ORIG  providers if-down.d        ifcfg-eth1       routes if-up.d          ifcfg-lo         scripts 

The bash configuration files

When bash is invoked as an interactive login shell, or as a non-interactive shell with the --login option, it first reads and executes commands from the file /etc/profile, if that file exists. After reading that file, it looks for ~/.bash_profile, ~/.bash_login, and ~/.profile, in that order, and reads and executes commands from the first one that exists and is readable.

When an interactive shell that is not a login shell is started, bash reads and executes commands from ~/.bashrc, if that file exists. [1]

[1] See man bash

In SuSE SLES, the /etc/profile file should not be changed because it can be overwritten by an update. Global shell customization should be done by editing the /etc/profile.local instead. User scripts should be placed in ~/.bashrc in order to make sure it will be used even if a login shell is not started.

Alternatives to bash

Open source software offers freedom of choice. If you prefer not to use bash, you can choose other shells , such as the following::

  • tcsh - an enhanced but completely compatible version of the Berkeley UNIX C shell, csh. [2]

    [2] See man tcsh and http://www.tcsh.org for more information

  • ksh -a public domain Korn shell. PD-ksh is a clone of the AT&T Korn shell. It currently offers most of the ksh88 features, not much of the ksh93 features, and a number of its own features. [3]

    [3] See man pdksh and http://web.cs.mun.ca/~michael/pdksh/ for more Information

  • zsh - the Z shell. Of the standard shells, zsh most closely resembles ksh, but includes many enhancements. [4]

    [4] See man zsh and http://www.zsh.org/ for more information

  • ash - a version of sh with features similar to those of the System V shell. [5]

    [5] See man ash

  • sash - a standalone shell with built-in commands (used for system recovery and installation).

 <  Day Day Up  >  


Quintero - Deploying Linux on IBM E-Server Pseries Clusters
Quintero - Deploying Linux on IBM E-Server Pseries Clusters
ISBN: N/A
EAN: N/A
Year: 2003
Pages: 108

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