In computing , a shell is a computer program that exposes an operating system 's services to a human user or other programs. In general, operating system shells use either a command-line interface (CLI) or graphical user interface (GUI), depending on a computer's role and particular operation. It is named a shell because it is the outermost layer around the operating system.
86-762: Bash , short for Bourne-Again SHell , is a shell program and command language supported by the Free Software Foundation and first developed for the GNU Project by Brian Fox . Designed as a 100% free software alternative for the Bourne shell , it was initially released in 1989. Its moniker is a play on words, referencing both its predecessor, the Bourne shell, and the concept of rebirth . Since its inception, Bash has gained widespread adoption and
172-421: A % sign before and after it. In DOS, OS/2 and Windows command-line interpreters as well as their API , upper or lower case is not distinguished for environment variable names. The environment variable named HOMEDRIVE contains the drive letter (plus its trailing : colon) of the user's home directory, whilst HOMEPATH contains the full path of the user's home directory within that drive. So to see
258-522: A read–eval–print loop, REPL ). Since the operating system shell is actually an application, it may easily be replaced with another similar application, for most operating systems. In addition to shells running on local systems, there are different ways to make remote systems available to local users; such approaches are usually referred to as remote access or remote administration. Initially available on multi-user mainframes , which provided text-based UIs for each active user simultaneously by means of
344-432: A teletypewriter can send codes representing keystrokes to a command interpreter program running on the computer; the command interpreter parses the sequence of keystrokes and responds with an error message if it cannot recognize the sequence of characters, or it may carry out some other program action such as loading an application program, listing files, logging in a user and many others. Operating systems such as UNIX have
430-688: A text terminal connected to the mainframe via serial line or modem , remote access has extended to Unix-like systems and Microsoft Windows. On Unix-like systems, Secure Shell protocol (SSH) is usually used for text-based shells, while SSH tunneling can be used for X Window System –based graphical user interfaces (GUIs). On Microsoft Windows, Remote Desktop Protocol can be used to provide GUI remote access, and since Windows Vista , PowerShell Remote can be used for text-based remote access via WMI, RPC, and WS-Management. Most operating system shells fall into one of two categories – command-line and graphical. Command-line shells provide
516-595: A "...person who has made a renewed or confirmed commitment ...." Whatever the original touchstone may have been, in the end the program received the name, "the Bourne Again SHell ." The acronym of that name then is "bash," a word meaning "to strike violently." In the context of computer programming, to "violently hit something," such as a computer keyboard, could be considered a hyperbolic image of some frustration . Such imagery of negative emotionality could be seen as standing in direct juxtaposition to
602-453: A "here string" using the <<< operator. Bash 3.0 supports in-process regular expression matching using a syntax reminiscent of Perl . In February 2009, Bash 4.0 introduced support for associative arrays . Associative array indices are strings, in a manner similar to AWK or Tcl . They can be used to emulate multidimensional arrays. Bash 4 also switches its license to GPL-3.0-or-later ; some users suspect this licensing change
688-462: A colon (common on Unix and Unix-like) or semicolon-delineated (common on Windows and DOS) list. The variables can be used both in scripts and on the command line . They are usually referenced by putting special symbols in front of or around the variable name. It is conventional for environment-variable names to be chosen to be in all upper cases. In programming code generally, this helps to distinguish environment variables from other kinds of names in
774-424: A command-line interface (CLI) to the operating system, while graphical shells provide a graphical user interface (GUI). Other possibilities, although not so common, include a voice user interface and various implementations of a text-based user interface (TUI) that are not CLI, such as text-based menu systems. The relative merits of CLI- and GUI-based shells are often debated. Many computer users use both depending on
860-459: A command-line interface. For example, in Unix-like systems, the telnet program has a number of commands for controlling a link to a remote computer system. Since the commands to the program are made of the same keystrokes as the data being sent to a remote computer, some means of distinguishing the two are required. An escape sequence can be defined, using either a special local keystroke that
946-481: A concurrent execution of command1 and command2, they must be executed in the Bash shell in the following way: In this case command1 is executed in the background & symbol, returning immediately control to the shell that executes command2 in the foreground. A process can be stopped and control returned to bash by typing Ctrl + z while the process is running in the foreground. A list of all processes, both in
SECTION 10
#17327759686441032-402: A feature, although with somewhat different syntax, usage and standard variable names. In all Unix and Unix-like systems, as well as on Windows, each process has its own separate set of environment variables . By default, when a process is created, it inherits a duplicate run-time environment of its parent process, except for explicit changes made by the parent when it creates the child. At
1118-428: A free shell that could run existing shell scripts so strategic to a completely free system built from BSD and GNU code that this was one of the few projects they funded themselves, with Fox undertaking the work as an employee of FSF. Fox released Bash as a beta, version .99, on June 8, 1989, and remained the primary maintainer until sometime between mid-1992 and mid-1994, when he was laid off from FSF and his responsibility
1204-530: A large variety of shell programs with different commands, syntax and capabilities, with the POSIX shell being a baseline. Some operating systems had only a single style of command interface; commodity operating systems such as MS-DOS came with a standard command interface ( COMMAND.COM ) but third-party interfaces were also often available, providing additional features or functions such as menuing or remote program execution. Application programs may also implement
1290-646: A minimum amount of free environment space that will be available when launching secondary shells. While the content of environment variables remains unchanged upon storage, their names (without the " % ") are always converted to uppercase, with the exception of pre-environment variables defined via the CONFIG.SYS directive SET under DR DOS 6.0 and higher (and only with SWITCHES=/L (for "allow lowercase names") under DR-DOS 7.02 and higher). In principle, MS-DOS 7.0 and higher also supports lowercase variable names ( %windir% ), but provides no means for
1376-520: A non-zero exit code. In DOS, OS/2 and Windows command-line interpreters such as COMMAND.COM and CMD.EXE , the SET command is used to assign environment variables and values using the following arguments: An environment variable is removed via: The SET command without any arguments displays all environment variables along with their values; SET " " , zero or more spaces, will include internal variables too. In CMD.EXE , it
1462-468: A percent sign: Bash supplies "conditional execution" command separators that make execution of a command contingent on the exit code set by a precedent command. For example: Where ./do_something is only executed if the cd (change directory) command was "successful" (returned an exit status of zero) and the echo command would only be executed if either the cd or the ./do_something command return an "error" (non-zero exit status). For all commands
1548-484: A piece of code uses such a feature, it is called a "bashism" – a problem for portable use. Debian's checkbashisms and Vidar Holen's shellcheck can be used to make sure that a script does not contain these parts. The list varies depending on the actual target shell: Debian's policy allows some extensions in their scripts (as they are in the dash shell), while a script intending to support pre-POSIX Bourne shells, like autoconf 's configure , are even more limited in
1634-408: A process to the foreground, while bg sets a stopped process running in the background. bg and fg can take a job id as their first argument, to specify the process to act on. Without one, they use the default process, identified by a plus sign in the output of jobs . The kill command can be used to end a process prematurely, by sending it a signal . The job id must be specified after
1720-433: A purpose-built program. Several command-line shells, such as Nushell , Xonsh, Bash (Unix shell) , and Z shell , offer command-line completion , enabling the interpreter to expand commands based on a few characters input by the user. A command-line interpreter may offer a history function, so that the user can recall earlier commands issued to the system and repeat them, possibly with some editing. Since all commands to
1806-419: A set of loosely coupled utilities. Most graphical user interfaces develop the metaphor of an "electronic desktop" , where data files are represented as if they were paper documents on a desk, and application programs similarly have graphical representations instead of being invoked by command names. Graphical shells typically build on top of a windowing system . In the case of X Window System or Wayland ,
SECTION 20
#17327759686441892-413: A setuid process. setuid programs usually unset unknown environment variables and check others or set them to reasonable values. In general, the collection of environment variables function as an associative array where both the keys and values are strings. The interpretation of characters in either string differs among systems. When data structures such as lists need to be represented, it is common to use
1978-404: A shell is a piece of software that is an "empty" expert system without the knowledge base for any particular application. Environment variable An environment variable is a user-definable value that can affect the way running processes will behave on a computer. Environment variables are part of the environment in which a process runs. For example, a running process can query
2064-485: A shell script. However, in Unix, non-exported variables are preferred for this as they do not leak outside the process. In Unix, an environment variable that is changed in a script or compiled program will only affect that process and possibly child processes. The parent process and any unrelated processes will not be affected. Similarly, changing or removing a variable's value inside a DOS or Windows batch file will change
2150-406: A third integer to specify the increment. When brace expansion is combined with variable expansion (A.K.A. parameter expansion and parameter substitution ) the variable expansion is performed after the brace expansion, which in some cases may necessitate the use of the eval built-in, thus: ‹The template How-to is being considered for merging .› When Bash starts, it executes
2236-438: A user presses the tab key within an interactive command-shell, Bash automatically uses command line completion , since beta version 2.04, to match partly typed program names, filenames and variable names. The Bash command-line completion system is very flexible and customizable, and is often packaged with functions that complete arguments and filenames for specific programs and tasks. Bash's syntax has many extensions lacking in
2322-679: A zero-length string. Standard environment variables or reserved environment variables include: The DR-DOS family supports a number of additional standard environment variables including: Datalight ROM-DOS supports a number of additional standard environment variables as well including: %TZ% , %COMM% , %SOCKETS% , %HTTP_DIR% , %HOSTNAME% and %FTPDIR% are also used by ROM-DOS. These environment variables refer to locations of critical operating system resources, and as such generally are not user-dependent. User management variables store information related to resources and settings owned by various user profiles within
2408-487: Is a good example of the former sort of application. LiteStep and Emerge Desktop are good examples of the latter. Interoperability programmes and purpose-designed software lets Windows users use equivalents of many of the various Unix-based GUIs discussed below, as well as Macintosh. An equivalent of the OS/2 Presentation Manager for version 3.0 can run some OS/2 programmes under some conditions using
2494-533: Is commonly used as the default login shell for numerous Linux distributions. It holds historical significance as one of the earliest programs ported to Linux by Linus Torvalds , alongside the GNU Compiler ( GCC ). It is available on nearly all modern operating systems, making it a versatile tool in various computing environments. As a command processor , Bash operates within a text window where users input commands to execute various tasks. It also supports
2580-545: Is mailed to the Bash maintainers (or optionally to other email addresses). Bash supports programmable completion via built-in complete , compopt , and compgen commands. The feature has been available since the beta version of 2.04 released in 2000. These commands enable complex and intelligent completion specification for commands (i.e. installed programs), functions, variables, and filenames. The complete and compopt two commands specify how arguments of some available commands or options are going to be listed in
2666-471: Is never passed on but always interpreted by the local system. The program becomes modal, switching between interpreting commands from the keyboard or passing keystrokes on as data to be processed. A feature of many command-line shells is the ability to save sequences of commands for re-use. A data file can contain sequences of commands which the CLI can be made to follow as if typed in by a user. Special features in
Bash (Unix shell) - Misplaced Pages Continue
2752-462: Is not distinguished for environment variable names. The following command displays all environment variables and their values: The commands env and set can be used to set environment variables and are often incorporated directly into the shell. The following commands can also be used, but are often dependent on a certain shell. A few simple principles govern how environment variables achieve their effect. Environment variables are local to
2838-451: Is possible to assign local variables that will not be global using the SETLOCAL command and ENDLOCAL to restore the environment. Use the switch /? to display the internal documentation , or use the viewer help : In PowerShell , the assignment follows a syntax similar to Unix: Examples of environment variables include: Under DOS, the master environment
2924-509: Is provided by the primary command processor, which inherits the pre-environment defined in CONFIG.SYS when first loaded. Its size can be configured through the COMMAND /E:n parameter between 160 and 32767 bytes. Local environment segments inherited to child processes are typically reduced down to the size of the contents they hold. Some command-line processors (like 4DOS ) allow to define
3010-430: Is readable, skipping the part after the && if it is not. Some versions of Unix and Linux contain Bash system startup scripts, generally under the /etc directory. Bash executes these files as part of its standard initialization, but other startup files can read them in a different order than the documented Bash startup sequence. The default content of the root user's files may also have issues, as well as
3096-715: Is stored in the Windows Registry or set in the AUTOEXEC.BAT file. On Unix , a setuid program is given an environment chosen by its caller, but it runs with different authority from its caller. The dynamic linker will usually load code from locations specified by the environment variables $ LD_LIBRARY_PATH and $ LD_PRELOAD and run it with the process's authority. If a setuid program did this, it would be insecure, because its caller could get it to run arbitrary code and hence misuse its authority. For this reason, libc unsets these environment variables at startup in
3182-468: Is why macOS continues to use older versions. Zsh became the default shell in macOS with the release of macOS Catalina in 2019. Brace expansion, also called alternation, is a feature copied from the C shell . It generates a set of alternative combinations. Generated results need not exist as files. The results of each expanded string are not sorted and left to right order is preserved: Users should not use brace expansions in portable shell scripts, because
3268-730: The API level, these changes must be done between running fork and exec . Alternatively, from command shells such as bash , a user can change environment variables for a particular command invocation by indirectly invoking it via env or using the ENVIRONMENT_VARIABLE=VALUE <command> notation. A running program can access the values of environment variables for configuration purposes. Shell scripts and batch files use environment variables to communicate data and preferences to child processes . They can also be used to store temporary values for reference later in
3354-453: The Bourne shell does not produce the same output. When brace expansion is combined with wildcards, the braces are expanded first, and then the resulting wildcards are substituted normally. Hence, a listing of JPEG and PNG images in the current directory could be obtained using: In addition to alternation, brace expansion can be used for sequential ranges between two integers or characters separated by double dots. Newer versions of Bash allow
3440-409: The C shell family (csh, tcsh, etc.) of Unix command line shells . It unsets a shell variable, removing it from memory and the shell's exported environment. It is implemented as a shell builtin , because it directly manipulates the internals of the shell. Read-only shell variables cannot be unset. If one tries to unset a read-only variable, the unset command will print an error message and return
3526-525: The Korn Shell , ksh . Bash is a POSIX -compliant shell with a number of extensions. While Bash was developed for UNIX and UNIX-like operating systems such as GNU/Linux, it is also available on Windows, BeOS, and Haiku. Brian Fox began coding Bash on January 10, 1988, after Richard Stallman became dissatisfied with the lack of progress being made by a prior developer. Stallman and the FSF considered
Bash (Unix shell) - Misplaced Pages Continue
3612-911: The Thompson shell in the first version of Unix. While simpler than the Multics shell, it contained some innovative features, which have been carried forward in modern shells, including the use of < and > for input and output redirection . The graphical shell first appeared in Douglas Engelbart ’s NLS system, demonstrated in December, 1968 at the Fall Joint Computer Conference in San Francisco, in what has been called The Mother of All Demos . Engelbart’s colleagues at Stanford Research Institute brought
3698-654: The image of childbirth. With that pun, it would seem, is added an allusion : possibly to the Hindu or Buddhist idea of reincarnation ; possibly to the Christian idiom known as "being born again ;" or quite possibly just to the more abstract idea of renewal . While numerous English translations of the Christian New Testament , Book of John , chapter 3 do contain the words "born again," Merriam-Webster 's dictionary has "born-again" defined as
3784-452: The language are all copied from sh . Other features, e.g., history , are copied from csh and ksh . The Bash command syntax is a superset of the Bourne shell command syntax. Bash supports brace expansion , command line completion (Programmable Completion), basic debugging and signal handling (using trap ) since bash 2.05a among other features. Bash can execute the vast majority of Bourne shell scripts without modification, with
3870-448: The readline input. As of version 5.1 completion of the command or the option is usually activated by the Tab ↹ keystroke after typing its name. The program's name is a figure of speech or witticism which begins with an homage to Stephen Bourne , the creator of one of the shell programs which have sometimes been considered superseded by the bash shell. His name is used as a pun on
3956-443: The 95 and NT types at least through Windows XP. The interfaces of Windows versions 1 and 2 were markedly different. Desktop applications are also considered shells, as long as they use a third-party engine. Likewise, many individuals and developers dissatisfied with the interface of Windows Explorer have developed software that either alters the functioning and appearance of the shell or replaces it entirely. WindowBlinds by StarDock
4042-573: The Bourne shell equivalent ' command > file 2>&1 '. Bash supports process substitution using the <(command) and >(command) syntax, which substitutes the output of (or input to) a command where a filename is normally used. (This is implemented through /proc/fd/ unnamed pipes on systems that support that, or via temporary named pipes where necessary). When using the 'function' keyword, Bash function declarations are not compatible with Bourne/Korn/POSIX scripts (the KornShell has
4128-412: The Bourne shell. Bash can perform integer calculations ("arithmetic evaluation") without spawning external processes. It uses the ((...)) command and the $ ((...)) variable syntax for this purpose. Its syntax simplifies I/O redirection . For example, it can redirect standard output (stdout) and standard error (stderr) at the same time using the &> operator. This is simpler to type than
4214-580: The CLI may apply when it is carrying out these stored instructions. Such batch files (script files) can be used repeatedly to automate routine operations such as initializing a set of programs when a system is restarted. Batch mode use of shells usually involves structures, conditionals, variables, and other elements of programming languages; some have the bare essentials needed for such a purpose, others are very sophisticated programming languages in and of themselves. Conversely, some programming languages can be used interactively from an operating system shell or in
4300-534: The GNU project, to ArcaOS , and to Android via various terminal emulation applications. In September 2014, Stéphane Chazelas, a Unix/Linux specialist, discovered a security bug in the program. The bug, first disclosed on September 24, was named Shellshock and assigned the numbers CVE - 2014-6271 , CVE- 2014-6277 and CVE- 2014-7169 . The bug was regarded as severe, since CGI scripts using Bash could be vulnerable, enabling arbitrary code execution . The bug
4386-558: The Microsoft Windows operating system use the Windows shell as their shell. Windows Shell provides desktop environment , start menu , and task bar , as well as a graphical user interface for accessing the file management functions of the operating system. Older versions also include Program Manager , which was the shell for the 3.x series of Microsoft Windows, and which in fact shipped with later versions of Windows of both
SECTION 50
#17327759686444472-459: The OS/2 environmental subsystem in versions of Windows NT. "Shell" is also used loosely to describe application software that is "built around" a particular component, such as web browsers and email clients, in analogy to the shells found in nature. Indeed, the (command-line) shell encapsulates the operating system kernel . These are also sometimes referred to as "wrappers". In expert systems ,
4558-403: The background and stopped, can be achieved by running jobs : In the output, the number in brackets refers to the job id. The plus sign signifies the default process for bg and fg . The text "Running" and "Stopped" refer to the process state . The last string is the command that started the process. The state of a process can be changed using various commands. The fg command brings
4644-635: The bash project has been committed to improving its usability. Since then, bash has become the de facto default shell program in most Linux and Unix operating systems. As the standard upon which bash is based, the POSIX, or IEEE Std 1003.1, et seq, is informative. Shell (computing) Operating systems provide various services to their users, including file management , process management (running and terminating applications ), batch processing , and operating system monitoring and configuration. Most operating system shells are not direct interfaces to
4730-421: The character ";", or on separate lines: In this example, when command1 is finished, command2 is executed, and when command2 has completed, command3 will execute. A background execution of command1 can occur using (symbol &) at the end of an execution command, and process will be executed in background while immediately returning control to the shell and allowing continued execution of commands. Or to have
4816-417: The code. Environment-variable names are case sensitive on Unix-like operating systems but not on DOS, OS/2, and Windows. In most Unix and Unix-like command-line shells , an environment variable's value is retrieved by placing a $ sign before the variable's name. If necessary, the name can also be surrounded by braces. To display the user home directory, the user may type: In Unix and Unix-like systems,
4902-453: The commands in a variety of dot files . Unlike Bash shell scripts, dot files do typically have neither the execute permission enabled nor an interpreter directive like #!/bin/bash . The example ~/.bash_profile below is compatible with the Bourne shell and gives semantics similar to csh for the ~/.bashrc and ~/.bash_login . The [ -r filename ] && cmd is a short-circuit evaluation that tests if filename exists and
4988-636: The concept to the Xerox Palo Alto Research Center (PARC), where it appeared on the Alto , introduced in 1973. From there the idea spread to Niklaus Wirth ’s Lilith in 1980, and the Apple Lisa in 1983, then became ubiquitous. A command-line interface (CLI) is an operating system shell that uses alphanumeric characters typed on a keyboard to provide instructions and data to the operating system, interactively. For example,
5074-427: The contents of environment variables to exceed 128 characters. DR-DOS COMMAND.COM supports environment variables up to 255, 4DOS even up to 512 characters. Since COMMAND.COM can be configured (via /L:128..1024 ) to support command lines up to 1024 characters internally under MS-DOS 7.0 and higher, environment variables should be expected to contain at least 1024 characters as well. In some versions of DR-DOS,
5160-405: The environment as needed and lastly the child replaces itself with the program to be called. This procedure gives the calling program control over the environment of the called program. In Unix shells, variables may be assigned without the export keyword. Variables defined in this way are displayed by the set command, but are not true environment variables, as they are stored only by
5246-486: The environment passed to drivers, which often do not need their environment after installation, can be shrunken or relocated through SETENV or INSTALL[HIGH] / LOADHIGH options /Z (zero environment), /D[: loaddrive ] (substitute drive, e.g. B:TSR.COM ) and /E (relocate environment above program) in order to minimize the driver's effectively resulting resident memory footprint . In batch mode, non-existent environment variables are replaced by
SECTION 60
#17327759686445332-430: The environment variables that Bash shell windows spawned from the window manager need, such as xterm or Gnome Terminal . Invoking Bash with the --posix option or stating set -o posix in a script causes Bash to conform very closely to the POSIX 1003.2 standard . Bash shell scripts intended for portability should take into account at least the POSIX shell standard. Some bash features not found in POSIX are: If
5418-466: The exception of Bourne shell scripts stumbling into fringe syntax behavior interpreted differently in Bash or attempting to run a system command matching a newer Bash builtin, etc. Bash command syntax includes ideas drawn from the Korn Shell (ksh) and the C shell (csh) such as command line editing, command history ( history command), the directory stack, the $ RANDOM and $ PPID variables, and POSIX command substitution syntax $ (...) . When
5504-399: The execution of commands from files, known as shell scripts , facilitating automation . In keeping with Unix shell conventions, Bash incorporates a rich set of features. The keywords , syntax , dynamically scoped variables and other basic features of the language are all copied from the Bourne shell , sh . Other features, e.g., history , are copied from the C shell , csh , and
5590-408: The exit status is stored in the special variable $ ? . Bash also supports if ... ; then ... ; else ... ; fi and case $ VARIABLE in $ pattern ) ... ;; $ other_pattern ) ... ;; esac forms of conditional command evaluation. An external command called bashbug reports Bash shell bugs. When the command is invoked, it brings up the user's default editor with a form to fill in. The form
5676-402: The features they can use. Bash uses GNU Readline to provide keyboard shortcuts for command line editing using the default ( Emacs ) key bindings. Vi-bindings can be enabled by running set -o vi . The Bash shell has two modes of execution for commands: batch (asynchronous), and concurrent (synchronous). To execute commands in batch mode (i.e., in sequence) they must be separated by
5762-419: The home drive and path, the user may type this: The command SET (with no arguments) displays all environment variables and their values. In Windows NT and later set can also be used to print all variables whose name begins with a given prefix by giving the prefix as the sole argument to the command. In Windows PowerShell , the user may type any of the following: In PowerShell, upper or lower case
5848-429: The idea of "using commands somehow like a programming language," and coined the term shell to describe it. In a 1965 document, the shell is defined as "a common procedure called automatically by the supervisor whenever a user types in some message at his console, at a time when he has no other process in active execution under console control. This procedure acts as an interface between console messages and subroutine [in
5934-446: The idea of becoming "born again." The naming could be considered an instance of verbal irony or accidental innuendo . Bash grammar was initially based on the grammars of the most popular Unix shell programs then currently in use, some of which were considered particularly difficult to use or frustrating at that time. As the years progressed, bash development has made its grammar more user-friendly, so much so that it seems likely that
6020-412: The names of environment variables are case-sensitive. The command env displays all environment variables and their values. The command printenv can also be used to print a single variable by giving that variable name as the sole argument to the command. In DOS, OS/2 and Windows command-line interpreters such as COMMAND.COM and CMD.EXE , an environment variable is retrieved by placing
6106-598: The operating system had to be typed by the user, short command names and compact systems for representing program options were common. Short names were sometimes hard for a user to recall, and early systems lacked the storage resources to provide a detailed on-line user instruction guide. A graphical user interface (GUI) provides means for manipulating programs graphically, by allowing for operations such as opening, closing, moving and resizing windows , as well as switching focus between windows. Graphical shells may be included with desktop environments or come separately, even as
6192-409: The process in which they were set. If two shell processes are spawned and the value of an environment variable is changed in one, that change will not be seen by the other. When a child process is created, it inherits all the environment variables and their values from the parent process. Usually, when a program calls another program, it first creates a child process by forking , then the child adjusts
6278-558: The same problem when using 'function'), but Bash accepts the same function declaration syntax as the Bourne and Korn shells, and is POSIX-conformant. Because of these and other differences, Bash shell scripts are rarely runnable under the Bourne or Korn shell interpreters unless deliberately written with that compatibility in mind, which is becoming less common as Linux becomes more widespread. But in POSIX mode, Bash conforms with POSIX more closely. Bash supports here documents . Since version 2.05b Bash can redirect standard input (stdin) from
6364-455: The shell and are unknown to all other processes. The printenv command will not display them, and child processes do not inherit them. The prefix syntax exports a "true" environment variable to a child process without affecting the current process: The persistence of an environment variable can be session-wide or system-wide. unset is a builtin command implemented by both the Bourne shell family ( sh , ksh , bash , etc.) and
6450-561: The shell consists of an X window manager or a Wayland compositor , respectively, as well as of one or multiple programs providing the functionality to start installed applications, to manage open windows and virtual desktops, and often to support a widget engine. In the case of macOS , Quartz Compositor acts as the windowing system, and the shell consists of the Finder , the Dock , SystemUIServer, and Mission Control . Modern versions of
6536-410: The skeleton files the system provides to new user accounts upon setup. The startup scripts that launch the X window system may also do surprising things with the user's Bash startup scripts in an attempt to set up user-environment variables before launching the window manager . These issues can often be addressed using a ~/.xsession or ~/.xprofile file to read the ~/.profile — which provides
6622-451: The supervisor]." This system was first implemented by Glenda Schroeder and an unnamed man from General Electric . Multics also introduced the active function , a key concept in all later shells. This is defined as a string... which is replaced by a character string return value before the command line containing it is executed. Active functions are often used... to implement command-language macros. In 1971, Ken Thompson developed
6708-566: The system or a user process. The purpose of such a procedure is to create a medium of exchange into which one could activate any procedure, as if it were called from the inside of another program . Hereafter, for simplification, we shall refer to that procedure as the "SHELL". Louis Pouzin, The SHELL: A Global Tool for Calling and Chaining Procedures in the System In 1964, for the Multics operating system, Louis Pouzin conceived
6794-743: The system. As a general rule, these variables do not refer to critical system resources or locations that are necessary for the OS to run. Optional System variables are not explicitly specified by default but can be used to modify the default behavior of certain built-in console commands. These variables also do not need to be explicitly specified as command line arguments. The following tables shows typical default values of certain environment variables under English versions of Windows as they can be retrieved under CMD . (Some of these variables are also defined when running COMMAND.COM under Windows, but differ in certain important details: Under COMMAND.COM ,
6880-499: The task to be performed. Early interactive systems provided a simple command-line interpreter as part of the resident monitor . This interpreter might be called by different names, such as COMCON on DEC TOPS-10 systems. The interpreter would execute one of a number of predefined commands, one of which would be to run a user program. Common commands would log the user on and off the system, allocate, free, and manipulate devices and files, and query various pieces of information about
6966-440: The underlying kernel , even if a shell communicates with the user via peripheral devices attached to the computer directly. Shells are actually special applications that use the kernel API in just the same way as it is used by other application programs. A shell manages the user–system interaction by prompting users for input, interpreting their input, and then handling output from the underlying operating system (much like
7052-468: The user to define them. Environment variable names containing lowercase letters are stored in the environment just like normal environment variables, but remain invisible to most DOS software, since they are written to expect uppercase variables only. Some command processors limit the maximum length of a variable name to 80 characters. While principally only limited by the size of the environment segment , some DOS and 16-bit Windows programs do not expect
7138-659: The value of the TEMP environment variable to discover a suitable location to store temporary files , or the HOME or USERPROFILE variable to find the directory structure owned by the user running the process. They were introduced in their modern form in 1979 with Version 7 Unix , so are included in all Unix operating system flavors and variants from that point onward including Linux and macOS . From PC DOS 2.0 in 1982, all succeeding Microsoft operating systems, including Microsoft Windows , and OS/2 also have included them as
7224-437: The variable for the duration of COMMAND.COM or CMD.EXE 's existence, respectively. In Unix, the environment variables are normally initialized during system startup by the system init startup scripts , and hence inherited by all other processes in the system. Users can, and often do, augment them in the profile script for the command shell they are using. In Microsoft Windows, each environment variable's default value
7310-527: Was related to how Bash passes function definitions to subshells through environment variables . As a command processor , Bash operates within a text window where users input commands to execute various tasks. It also supports the execution of commands from files, known as shell scripts , facilitating automation . In keeping with Unix shell conventions, Bash incorporates a rich set of features, including: Bash also offers... The keywords , syntax , dynamically scoped variables and other basic features of
7396-561: Was transitioned to another early contributor, Chet Ramey. Since then, Bash has become by far the most popular shell among users of Linux, becoming the default interactive shell on that operating system's various distributions and on Apple's macOS releases before Catalina in October 2019. Bash has also been ported to Microsoft Windows and distributed with Cygwin and MinGW , to DOS by the DJGPP project, to Novell NetWare , to OpenVMS by
#643356