| Bash | |
|---|---|
Screenshot of bash and sh sessions demonstrating some features |
|
| Developed by | Chet Ramey |
| Latest release | 3. 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 A software developer is a person or organization concerned with facets of the software development process wider than design and coding a somewhat broader scope of Chet Ramey is the current maintainer of the GNU Bourne Again Shell. A software release is the distribution whether public or private of an initial or new and upgraded version of a Computer software product 2. 33 / December 15, 2007 |
| Written in | C |
| OS | Cross-platform |
| Platform | Cross-platform |
| Available in | English, multilingual (gettext) |
| Development status | Active |
| Genre | Unix shell |
| License | GNU General Public License |
| Website | Official website |
Bash is a Unix shell written for the GNU Project. Events 533 - Byzantine general Belisarius defeats the Vandals, commanded by King Gelimer, at the Battle of Year 2007 ( MMVII) was a Common year starting on Monday of the Gregorian calendar in the 21st century. A programming language is an Artificial language that can be used to write programs which control the behavior of a machine particularly a Computer. tags please moot on the talk page first! --> In Computing, C is a general-purpose cross-platform block structured An operating system (commonly abbreviated OS and O/S) is the software component of a Computer system that is responsible for the management and coordination In computing cross-platform (also known as multi-platform) is a term used to refer to Computer software or computing methods and concepts that are implemented In Computing, a platform describes some sort of Hardware architecture or Software framework (including Application frameworks, that allows In computing cross-platform (also known as multi-platform) is a term used to refer to Computer software or computing methods and concepts that are implemented A language is a dynamic set of visual auditory or tactile Symbols of Communication and the elements used to manipulate them Computer software can be organized into categories based on common function type or field of use A Unix shell, is a command line shell that provides the traditional User interface for the Unix Operating system and for Unix-like A software license (or software licence in commonwealth usage is a Legal instrument governing the usage or redistribution of copyright protected software A website (alternatively web site or Web site, a back-construction from the Proper noun World Wide Web) is a collection of Web pages A Unix shell, is a command line shell that provides the traditional User interface for the Unix Operating system and for Unix-like The GNU Project is a Free software, Mass collaboration project announced in 1983 by Richard Stallman. Its name is an acronym for Bourne-again shell,[1] a pun on the name of the Bourne shell (sh) (i. Acronyms, initialisms, and alphabetisms are Abbreviations that are formed using the initial components in a phrase or name A pun (or paronomasia) is a Phrase that deliberately exploits confusion between similar-sounding Words for humorous or Rhetorical 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 e. "Bourne again" or "born again"), an early and important Unix shell written by Stephen Bourne[2] and distributed with Version 7 Unix circa 1978. Steve Bourne is a computer scientist most famous as the author of the Bourne shell (sh which is the foundation for Seventh Edition Unix, also called Version 7 Unix, Version 7 or just V7, was an important early release of the Unix Operating system Bash was created in 1987 by Brian Fox. Brian J Fox (born 1959 is a Computer programmer, author and Open source advocate. In 1990 Chet Ramey became the primary maintainer. Chet Ramey is the current maintainer of the GNU Bourne Again Shell.
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. GNU ( pronounced) is a computer Operating system composed entirely of Free software. Linux (commonly pronounced ˈlɪnəks Mac OS X (mæk oʊ ɛs tɛn is a line of computer Operating systems developed marketed and sold by Apple Inc, the latest of which is pre-loaded on all currently A Unix-like (sometimes shortened to *nix) Operating system is one that behaves in a manner similar to a Unix system while not necessarily conforming 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. Microsoft Windows is a series of Software Operating systems and Graphical user interfaces produced by Microsoft. Cygwin (ˈsɪɡwɪn is a collection of tools originally developed by Cygnus Solutions to provide in Microsoft Windows a command line and programming interface familiar POSIX (ˈpɒzɪks or "Portable Operating System Interface" is the collective name of a family of related standards specified by the IEEE to define MS-DOS (short for M icro' s' oft D isk O perating S ystem is an Operating system commercialized by Microsoft. DJGPP (DJ's GNU Programming Platform is a 32-bit C / C++ / ObjC / ObjC++ / Ada / Fortran development suite for 386 NetWare is a Network operating system developed by Novell Inc Released under the GNU General Public License, Bash is free software. Free software or software libre is Software that can be used studied and modified without restriction and which can be copied and redistributed in modified or unmodified Independent versions of Bash were created also for AmigaOS. AmigaOS is the default native Operating system of the Amiga personal computer
Contents |
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. In computing 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 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: $(. 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 Command history is a common feature in operating system shells (such as Korn shell, Bash, Cmd POSIX (ˈpɒzɪks or "Portable Operating System Interface" is the collective name of a family of related standards specified by the IEEE to define . . ). When used as an interactive command shell and pressing the tab key, Bash automatically completes partly typed program names, filenames, variable names, etc. Tab key (abbreviation of tabulator key) on a keyboard is used to advance the cursor to the next Tab stop. Command line completion is a common feature of Command line interpreters in which the program automatically fills in partially typed tokens
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 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 following syntax. In Unix and Unix-like operating systems as well as certain Programming language interfaces the standard streams are preconnected input and output channels In Unix and Unix-like operating systems as well as certain Programming language interfaces the standard streams are preconnected input and output channels
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. A here document (also called a here-document or a heredoc) is a way of specifying a String literal in command line shells such as Bash However, since version 2. 05b Bash can redirect standard input (stdin) from a "here string" using the following syntax. In Unix and Unix-like operating systems as well as certain Programming language interfaces the standard streams are preconnected input and output channels
command <<< "string to be read as standard input"
Bash 3. 0 supports in-process regular expression matching using the following syntax, reminiscent of Perl:
[[ string =~ regex ]]
The regular expression syntax is the same as that documented by the regex(7) man page. In Computing, regular expressions provide a concise and flexible means for identifying strings of text of interest such as particular characters words or patterns of characters NOTES FOR EDITORS "Perl" is not an acronym (read the "Name" section below Almost all substantial UNIX and Unix-like Operating systems have extensive documentation known as man pages (short for "manual pages"
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. POSIX (ˈpɒzɪks or "Portable Operating System Interface" is the collective name of a family of related standards specified by the IEEE to define 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.
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.
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, in October 2006, to ship the Debian Almquist shell, dash, as the default scripting shell, causing a wide variety of scripts to fail. Ubuntu Kubuntu Edubuntu Xubuntu Gobuntu --> Ubuntu D ebian A lmquist sh ell ( dash) is a POSIX -compliant Unix shell, much smaller than Bash.