FACTOID # 167: Like living in cities? Guadeloupe, Nauru, Monaco, Singapore, Gibraltar and Bermuda are only nations that are 100% urbanised.
 
 Home   Encyclopedia   Statistics   Countries A-Z   Flags   Maps   Education   Forum   FAQ   About 
 
WHAT'S NEW
RELATED ARTICLES
People who viewed "Bash" also viewed:
RECENT ARTICLES
More Recent Articles »
 

SEARCH ALL

FACTS & STATISTICS    Advanced view

Search encyclopedia, statistics and forums:

 

 

(* = Graphable)

 

 


Encyclopedia > Bash
Bash

Screenshot of a bash session demonstrating some features
Developer: Chet Ramey
Latest release: 3.2.25 / 22 August 2007
OS: Cross-platform
Platform: Cross-platform
Available language(s): ?
Status: ?
Genre: Unix shell
License: GNU General Public License
Website: Official website

Bash is a Unix shell written for the GNU Project. The name of the actual executable is bash. Its name is an acronym for Bourne-again shell, a pun on the name of the Bourne shell (sh) (i.e. "Bourne again" or "born again"), an early and important Unix shell written by Stephen Bourne and distributed with Version 7 Unix circa 1978. Bash was created in 1987 by Brian Fox. In 1990 Chet Ramey became the primary maintainer. Image File history File links Question_book-3. ... Bash can have different meanings; some usage cleverly combines different meanings. ... Image File history File links No higher resolution available. ... Image File history File links Size of this preview: 559 × 599 pixelsFull resolution (566 × 607 pixel, file size: 34 KB, MIME type: image/png) Note: if the screenshot shows any work that is not a direct result of the program code itself, such as a text or graphics that are... “Software development” redirects here. ... Chet Ramey is the current maintainer of the GNU Bourne Again Shell Chets home page FSF home page for Bash Categories: Computer stubs ... Code complete redirects here. ... is the 234th day of the year (235th in leap years) in the Gregorian calendar. ... Year 2007 (MMVII) is the current year, a common year starting on Monday of the Gregorian calendar and the AD/CE era in the 21st century. ... An operating system (OS) is the software that manages the sharing of the resources of a computer and provides programmers with an interface used to access those resources. ... A cross-platform (or platform independent) programming language, software application or hardware device works on more than one system platform (e. ... In computing, a platform describes some sort of framework, either in hardware or software, which allows software to run. ... A cross-platform (or platform independent) programming language, software application or hardware device works on more than one system platform (e. ... Computer software can be organized into categories based on common function, type, or field of use. ... Screenshot of a sample Bash session, taken on Gentoo Linux. ... A software license is a legal agreement which may take the form of a proprietary or gratuitous license as well as a memorandum of contract between a producer and a user of computer software. ... The GNU logo The GNU General Public License (GNU GPL or simply GPL) is a widely-used free software license, originally written by Richard Stallman for the GNU project. ... A website (alternatively, Web site or web site) is a collection of Web pages, images, videos or other digital assets that is hosted on one or several Web server(s), usually accessible via the Internet, cell phone or a LAN. A Web page is a document, typically written in HTML... Screenshot of a sample Bash session, taken on Gentoo Linux. ... The GNU logo, drawn by Etienne Suvasa The GNU Project was announced in 1983 by Richard Stallman. ... It has been suggested that this article or section be merged with Backronym and Apronym (Discuss) Acronyms and initialisms are abbreviations, such as NATO, laser, and ABC, written as the initial letter or letters of words, and pronounced on the basis of this abbreviated written form. ... For other uses, see Pun (disambiguation). ... The Bourne shell, or sh, was the default Unix shell of Unix Version 7, and replaced the Thompson shell, whose executable file had the same name, sh. ... Born again is a term used originally and mainly in Christianity, where it is associated with salvation, conversion and spiritual rebirth. ... Steve Bourne is a computer scientist, most famous as the author of the Bourne shell (sh), which remains the standard command line interface to Unix. ... Seventh Edition Unix, also called Version 7 Unix, Version 7 or just V7, was an important early release of the Unix operating system. ... Brian Fox is a free software programmer. ... Chet Ramey is the current maintainer of the GNU Bourne Again Shell Chets home page FSF home page for Bash Categories: Computer stubs ...


Bash is the default shell on most 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 within the Cygwin POSIX emulation environment for Windows, to MS-DOS by the DJGPP project and to Novell NetWare. Released under the GNU General Public License, Bash is free software. Independent versions of Bash were created also for AmigaOS. This article is about operating systems that use the Linux kernel. ... Mac OS X (IPA: ) is a line of graphical operating systems developed, marketed, and sold by Apple Inc. ... Diagram of the relationships between several Unix-like systems A Unix-like operating system is one that behaves in a manner similar to a Unix system, while not necessarily conforming to or being certified to any version of the Single UNIX Specification. ... “Windows” redirects here. ... Cygwin (pronounced ) is a collection of free software tools originally developed by Cygnus Solutions to allow various versions of Microsoft Windows to act similar to a Unix system. ... POSIX or Portable Operating System Interface[1] is the collective name of a family of related standards specified by the IEEE to define the application programming interface (API) for software compatible with variants of the Unix operating system. ... Microsofts disk operating system, MS-DOS, was Microsofts implementation of DOS, which was the first popular operating system for the IBM PC, and until recently, was widely used on the PC compatible platform. ... DJGPP is a 32-bit C/C++/ObjC/Ada/Fortran development suite for 386+ PCs that runs under DOS (or any OS that runs DOS . ... NetWare is a network operating system developed by Novell, Inc. ... The GNU logo The GNU General Public License (GNU GPL or simply GPL) is a widely-used free software license, originally written by Richard Stallman for the GNU project. ... Clockwise from top: The logo of the GNU Project, the Linux kernel mascot Tux, and the BSD Daemon Free software is software that can be used, studied, and modified without restriction, and which can be copied and redistributed in modified or unmodified form either without restriction, or with restrictions only... AmigaOS is the default native operating system of the Amiga personal computer. ...

Contents

Features

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 completes partly typed program names, filenames, variable names, etc. A shell script is a script written for the shell, or command line interpreter, of an operating system. ... In Unix, a shell builtin is a command or a function, called from a shell, that is executed directly in the shell itself, instead of an external executable program which the shell would load and execute. ... The Korn shell (ksh) is a Unix shell which was developed by David Korn (AT&T Bell Laboratories) in the early 1980s. ... The C shell (csh) is a Unix shell developed by Bill Joy for the BSD Unix system. ... POSIX or Portable Operating System Interface[1] is the collective name of a family of related standards specified by the IEEE to define the application programming interface (API) for software compatible with variants of the Unix operating system. ... This article is about the use of the term Tab in computing. ... Command line completion is a common command line interpreters feature, which allows to automatically fill-in partially typed elements. ...


Bash's syntax has many extensions which the Bourne shell lacks. Several are enumerated here.


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 which are not possible in the traditional Bourne shell. For example, Bash can redirect standard output and standard error at the same time using the following syntax. Redirection is a function common to most Unix shells which allow standard streams to be redirected to user-specified locations. ... The standard streams are a set of input and output channels featured in Unix and Unix-like operating systems, and provided by the standard I/O library (stdio. ... The standard streams for input, output, and error The standard streams are preconnected input or output channels between a computer program and its environment (typically a text terminal) when it begins execution. ...

 command &> file 

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 from a "here string" using the following syntax. A here document (also called a here-document or a heredoc), is a way of specifying a string literal in shells such as Bash, Windows PowerShell and the Bourne Shell, as well as programming languages such as Perl, PHP, Python and Ruby. ...

 command <<< "string to be read as standard input" 

Bash 3.0 supports in-process regular expression matching using the following syntax, reminiscent of Perl: In computing, a regular expression is a string that is used to describe or match a set of strings, according to certain syntax rules. ... Wikibooks has a book on the topic of Perl Programming Perl is a dynamic programming language created by Larry Wall and first released in 1987. ...

 [[ string =~ regex ]] 

The regular expression syntax is the same as that documented by the regex(7)[1] man page. Almost all substantial UNIX and Unix-like operating systems have extensive documentation available as an electronic manual, split into multiple sections called man pages (short for manual pages and based on the command used to display them). ...


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.


When Bash is started non-interactively, to run a shell script, for example, it looks for the variable BASH_ENV in the environment, expands its value if it appears there, and uses the expanded value as the name of a file to read and execute. Bash behaves as if the following command were executed:

 if [ -n "$BASH_ENV" ]; then . "$BASH_ENV"; fi 

but the value of the PATH variable is not used to search for the file name.


If Bash is invoked with the name sh, it tries to mimic the startup behavior of historical versions of sh as closely as possible, while conforming to the POSIX standard as well. When invoked as an interactive login shell, or a non-interactive shell with the --login option, it first attempts to read and execute commands from /etc/profile and ~/.profile, in that order. The --noprofile option may be used to inhibit this behavior. When invoked as an interactive shell with the name sh, Bash looks for the variable ENV, expands its value if it is defined, and uses the expanded value as the name of a file to read and execute. Since a shell invoked as sh does not attempt to read and execute commands from any other startup files, the --rcfile option has no effect. A non-interactive shell invoked with the name sh does not attempt to read any other startup files. When invoked as sh, Bash enters POSIX mode after the startup files are read. POSIX or Portable Operating System Interface[1] is the collective name of a family of related standards specified by the IEEE to define the application programming interface (API) for software compatible with variants of the Unix operating system. ...


When Bash is started in POSIX mode, as with the --posix command line option, it follows the POSIX standard for startup files. In this mode, interactive shells expand the ENV variable and commands are read and executed from the file whose name is the expanded value. No other startup files are read.


Bash attempts to determine when it is being run by the remote shell daemon, usually rshd. If Bash determines it is being run by rshd, it reads and executes commands from ~/.bashrc, if that file exists and is readable. It will not do this if invoked as sh. The --norc option may be used to inhibit this behavior, and the --rcfile option may be used to force another file to be read, but rshd does not generally invoke the shell with those options or allow them to be specified.


Portability

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 is changed to begin with #!/bin/bash.


See also

Free software Portal

Image File history File links Free_Software_Portal_Logo. ... A shell is a computer program which interacts with the userland and subsequently the kernel of an operating system. ...

External links

Wikibooks
Wikibooks has a book on the topic of

  Results from FactBites:
 
Bash - Wikipedia, the free encyclopedia (1315 words)
bash is the default shell on most Linux systems as well as on Mac OS X Tiger, and it can be run on most Unix-like operating systems.
bash's command syntax is a superset of the Bourne shell's command syntax.
The 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
  More results at FactBites »


 

COMMENTARY     


Share your thoughts, questions and commentary here
Your name
Your comments
Please enter the 5-letter protection code

Want to know more?
Search encyclopedia, statistics and forums:

 


Lesson Plans | Student Area | Student FAQ | Reviews | Press Releases |  Feeds | Contact
The Wikipedia article included on this page is licensed under the GFDL.
Images may be subject to relevant owners' copyright.
All other elements are (c) copyright NationMaster.com 2003-5. All Rights Reserved.
Usage implies agreement with terms.