Supported by: ACS
Bash is a UNIX shell that was chosen as the default for RCS. A UNIX " shell " is a program that acts as the interface between you and the UNIX operating system. It prompts you for input, checks commands for syntax errors and, then executes them. As soon as you log on, you are using the shell. You do not have to do anything special to start up the default shell.
Bash, which stands for the Bourne-Again Shell, was chosen because it incorporates many popular features of other shell programs, such as the Bourne shell (sh), the C shell (csh), and the Korn shell (ksh). For example, bash uses the Bourne shell's programming syntax (also used by ksh), the C shell's job control and history functions, and the Korn shell's ability to edit previous command lines using common visual editors. In addition, bash has several attractive features of its own.
Bash has an on-line help feature that provides basic information about most of its built-in commands. To see the help description for a particular command, enter the following command at a UNIX prompt:
help command
(for example, help alias) at the bash UNIX prompt. To see a list of bash commands for which help is available, simply type help at the bash UNIX prompt. There is also an on line manual page for bash (enter man bash), but beware, it is 44 pages long.
Reissuing Commands
With bash, you can reissue commands by pressing the up or down arrow
key and pressing Enter or Return when the appropriate command reappers.
You can also edit the command line using your choice of emacs or vi commands.
The next time you issue commands in the UNIX window, press the up arrow key. Previously issued commands will appear on the command line, one at a time. Press the down arrow key to scroll back through them. Press the right or left arrow keys to move the cursor through the command. Anything you type will be inserted into the command. Use the Backspace key to erase characters. Press Return or Enter to issue one of those commands again.
You can also edit the commands before reentering them using emacs commands (the default). You can also use CTRL-p and CTRL-n to scroll through commands in your command history; use regular emacs commands to search for strings and edit a command line.
Finding File Names
A feature of bash is " filename completion." If you type
a filename as part of a UNIX command and you have typed enough of it to
uniquely identify the file, press the TAB key to make bash fill in the
rest of the filename for you.
If you have not typed enough characters to uniquely identify the file, the computer will beep; press TAB a second time to list possible file names.
Using Aliases and Functions
Bash allows you to define aliases and functions. With the alias command,
you can create abbreviations or new names for UNIX command sequences. Functions
are like aliases, except that they allow more complex expres- sions. You
can define aliases, functions, and environment variables in a .bash_aliases
file.
Using Aliases in Bash
Aliases are shortcuts, that is, command names that you can create to
take the place of longer commands. You can use your favorite editor to
create a .bash_aliases file and enter alias commands into it.
An alias command consists of the command alias, the name you want to give the alias, and a definition that contains the actual command for which you are creating an alias.
A sample alias command, for running a perl script called txt2html.pl is shown below. When this alias works, you would be able to type txt2html at any UNIX prompt and the script called txt2html.pl in doylez's locker directory will run.
alias txt2html="~doylez/locker/TXT2HTML/txt2html.pl"
You must always put an equal sign (=) between the alias and the alias definition, as shown above, and the alias definition should have quotes at the beginning and end of it if it contains more than one word.
The first time you put an alias in the .bash_aliases file, you must enter the command
. .bashrc
to source the file or make the system read it so you can use the new aliases and functions you have created.
There is an on line manual page on bash. To read it, enter the command man bash at a UNIX prompt.
Return to the ACS Consulting homepage.
Return to the General System page.
Return to ACS home page.
Please send comments and suggestions to