Infobox Software
name = Bash

caption = Screenshot of bash and sh sessions demonstrating some features
developer = Chet Ramey
latest release version = 3.2.39
latest release date = release date|2008|04|30
programming language = C
operating system = Cross-platform
platform = GNU
language = English, multilingual (gettext)
status = Active
genre = Unix shell
source model = Free software
license = GNU General Public License
website = [ Home page]

Bash is a free software Unix shell written for the GNU Project. Its name is an acronym which stands for "Bourne-again shell". [ [ C Programming] ] by Al Stevens, Dr. Dobb's Journal, July 1, 2001] The name is a pun on the name of the Bourne shell (sh), an early and important Unix shell written by Stephen Bourne and distributed with Version 7 Unix circa 1978, [ [ Fresh Faces] by Rosalyn Lum, Dr. Dobb's Journal, June 1, 2005] and the concept of being "born again". Bash was created in 1987 by Brian Fox. In 1990 Chet Ramey became the primary maintainer.cite web|first=Chet|last=Ramey|title=Bash - the GNU shell (Reflections and Lessons Learned)|url=|accessdate=2008-01-15]

Bash is the default shell on most GNU/Linux systems as well as on Mac OS X and it can be run on most Unix-like operating systems. It has also been ported to Microsoft Windows using the POSIX emulation provided by Cygwin, to MS-DOS by the DJGPP project and to Novell NetWare.


The Bash command syntax is a superset of the Bourne shell command syntax. The vast majority of Bourne shell scripts can be executed by Bash without modification, with the exception of Bourne shell scripts referencing a Bourne special variable or those using builtin Bourne commands. Bash command syntax includes ideas drawn from the Korn shell (ksh) and the C shell (csh) such as command line editing, command history, the directory stack, the $RANDOM and $PPID variables, and POSIX command substitution syntax $(…). When used as an interactive command shell and pressing the tab key, Bash automatically uses command line completion to match partly typed program names, filenames and variable names.

Bash's syntax has many extensions which the Bourne shell lacks. Bash can perform integer calculations without spawning external processes, unlike the Bourne shell. Bash uses the ((…)) command and the $ […] variable syntax for this purpose. Bash syntax simplifies I/O redirection in ways that are not possible in the traditional Bourne shell. For example, Bash can redirect standard output (stdout) and standard error (stderr) at the same time using the &> operator. This is simpler to type than the Bourne shell equivalent 'command > file 2>&1'.

Bash supports here documents just as the Bourne shell always has. However, since version 2.05b Bash can redirect standard input (stdin) from a "here string" using the <<< operator.

Bash 3.0 supports in-process regular expression matching using a syntax reminiscent of Perl. [The syntax matches that shown on the [ regex(7)] man page.]

Brace expansion

Brace expansion is a feature, originating in csh, that allows arbitrary strings to be generated using a similar technique to filename expansion. However the generated names need not exist as files. The results of each expanded string are not sorted and left to right order is preserved:

# This is a bash specific feature echo a{p,c,d,b}e # ape ace ade abe

Brace expansions should not be used in portable shell scripts, because a traditional shell will not produce the same output:

# A traditional shell does not produce the same output echo a{p,c,d,b}e # a{p,c,d,b}e

Startup scripts

When Bash starts, it executes the commands in a variety of different scripts.

When Bash is invoked as an interactive login shell, 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 a login shell exits, Bash reads and executes commands from the file ~/.bash_logout, if it exists.

When an interactive shell that is not a login shell is started, Bash reads and executes commands from ~/.bashrc, if that file exists. This may be inhibited by using the --norc option. The --rcfile file option will force Bash to read and execute commands from file instead of ~/.bashrc.


Shell scripts written with Bash-specific features ("bashisms") will not function on a system using the Bourne shell or one of its replacements, unless bash is installed as a secondary shell and the script begins with "#!/bin/bash". This problem became particularly important when Ubuntu began to ship the Debian Almquist shell (dash) as the default scripting shell in October 2006, causing a wide variety of scripts to fail.

See also

* Comparison of command shells


External links

* [ Bash home page]
* [ Bash Debugger]
* [ Learning the shell] .
* [;1591223321;fp;16;fpid;1;pf;1 2008 interview with GNU Bash's maintainer, Chet Ramey]
* [ Bash Online Forum]

Wikimedia Foundation. 2010.

Игры ⚽ Поможем решить контрольную работу

Look at other dictionaries:

  • Bash — Saltar a navegación, búsqueda bash Captura de pantalla de una sesión bash, tomada en GNU/Linux. Desarrollador …   Wikipedia Español

  • — …   Википедия

  • Bash — GNU Bourne Again SHell Типичная сессия в bash Тип командная оболочка UNIX Разработчик Чет Рамей (Chet Ramey) …   Википедия

  • bash on — (informal) To persevere, carry on • • • Main Entry: ↑bash * * * ˌbash ˈon [intransitive] [present tense I/you/we/they bash on he/she/it …   Useful english dictionary

  • Bash — (von engl. bash für ‚Schlag‘) steht für: Bourne again shell, eine in Unixoiden Systemen verwendete Shell und ist der Familienname folgender Personen: Baby Bash (* 1975), US amerikanischer Rapper Dana Bash (* 1971), US amerikanische Journalistin… …   Deutsch Wikipedia

  • bash up — [phrasal verb] bash up (someone) or bash (someone) up chiefly Brit, informal : to attack (someone) A group of older girls bashed up [=beat up] the sisters. • • • Main Entry: ↑ …   Useful english dictionary

  • Bash — Bash, v. t. [imp. & p. p. {Bashed}; p. pr. & vb. n. {Bashing}.] [Perh. of imitative origin; or cf. Dan. baske to strike, bask a blow, Sw. basa to beat, bas a beating.] To strike heavily; to beat; to crush. [Prov. Eng. & Scot.] Hall Caine. [1913… …   The Collaborative International Dictionary of English

  • Bash — es un shell de Unix (intérprete de comandos de Unix) escrito para el proyecto GNU. Su nombre es un acrónimo de Bourne again shell (Otro shell Bourne) un chascarrillo sobre el Bourne shell (sh), que fue uno de los primeros shells importantes de… …   Enciclopedia Universal

  • bash — informal ► VERB 1) strike hard and violently. 2) (bash out) produce rapidly and carelessly. ► NOUN 1) a heavy blow. 2) a party or social event. 3) Brit. an attempt: she ll have a bash at anything …   English terms dictionary

  • bash — [bash] vt. [echoic; akin to or < ? ON * basca, to strike] Informal 1. to strike with a violent blow; smash (in) 2. to attack or abuse, as with blows or with words n. 1. Informal a violent blow ☆ 2. Slang a gala event or party have a bash at …   English World dictionary

  • Bash — Bash, v. t. & i. [OE. baschen, baissen. See {Abash}.] To abash; to disconcert or be disconcerted or put out of countenance. [Obs.] [1913 Webster] His countenance was bold and bashed not. Spenser. [1913 Webster] …   The Collaborative International Dictionary of English

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”