Bash reference manual 6 (Bash features)

Source: Internet
Author: User
Tags call shell

6 Bash features


This section describes the unique features of Bash.
* Call Bash: command line options acceptable to Bash.
* Bash Startup File: When and how to execute the script in Bash.
* Interactive Shell: What is an interactive shell.
* Bash conditional expression: the expression element used by the built-in command test.
* Shell arithmetic: the arithmetic of shell variables.
* Alias: Give the command another name.
* Array: array variable.
* Directory Stack: Directory history accessed.
* Print prompt: controls the PS1 string.
* Restrict shell: More control modes for shell execution.
* Bash POSIX mode: Makes Bash behavior closer to the POSIX standard.


6.1 call Bash


Bash [long-opt] [-ir] [-abefhkmnptuvxdBCDHP] [-o option] [-O shopt_option] [argument…]

Bash [long-opt] [-abefhkmnptuvxdBCDHP] [-o option] [-O shopt_option]-c string [argument…]

Bash [long-opt]-s [-abefhkmnptuvxdBCDHP] [-o option] [-O shopt_option] [argument…]

All the options that can be used for a single character of the built-in command set (see the "Set built-in command" section) can be used as an option when shell is called. In addition, you can use multiple character options. To be recognized, these options must be placed before a single character option in the command line.


-- Debugger

Specify the configuration file for the debugger before starting the shell. Open the extended debugging mode (see the extdebug option of the shopt built-in command in shopt> ).

-- Dump-po-strings

A list of all double quotation marks enclosed by '$', printed in standard output in GNU gettext PO (Portable Object) format. In addition to the output format, it is equivalent to-D.

-- Dump-strings

It is equivalent to-D.

-- Help

Display the usage information on the standard output and exit successfully.

-- Init-file filename
-- Rcfile filename

In the interactive shell, execute the command from filename. (Instead ~ /. Bashrc)

-- Login

It is equivalent to-l.

-- Noediting

In the interactive shell, the GNU Readline library is not used (see the command line Editing Section) to read data from the command line.

-- Noprofile

When Bash is called in shell login mode, it does not load the system-level Startup file/etc/profile, or all personal Initialization Files ~ /. Bash_profile ,~ /. Bash_login, or ~ /. Profile.

-- Norc

Do not read the initialization file in the interactive shell ~ /. Bashrc. If you use sh to call shell, this option is enabled by default.

-- Posix

Change the default behavior in Bash that is different from the POSIX standard to conform to the POSIX standard. This option makes Bash behavior a strict superset of POSIX standards. See the Bash POSIX mode section for a description of the Bash POSIX mode.

-- Restricted

Make shell a restricted shell (see restricted shell ).

-- Verbose

It is equivalent to-v. Print the shell input line as is.

-- Version

The version information of the current Bash instance is displayed in the standard output and exits successfully.


There are several single-character options available when calling shell, but the built-in command set is not available.


-C string

After processing options, read and execute the command from the string, and then exit. All subsequent parameters are assigned to the location parameter, starting from $0.

-I

Force shell to run in interactive mode. For more information about the Interactive shell, see the interactive shell section.

-L

So that the current shell behavior is like directly called by login. When the shell is in interactive mode, it is equivalent to using 'exec-l bash' to start the login shell. When the shell is not interactive, run the login shell Startup File. 'Exec bash-l' or 'exec bash -- login' will replace the current shell with the Bash logon shell. See the Bash Startup File section to describe the special behavior of logging on to shell.

-R

Make shell a limit. (See restricted shell)

-S

If this option is displayed, or the option does not have a parameter after processing, the command is read from the standard input. When an interactive shell is called, this option allows you to set location parameters.

-D

A list of strings enclosed by all double quotation marks guided by '$' is printed on the standard output. When the current locale is not C or POSIX (see Locale translation), these strings are translated in the corresponding language. This option implies the-n option, that is, the command is not executed.

[-+] O [shopt_option]

Shopt_option is a shell option accepted by shopt (see shopt built-in commands ). If shopt_option appears,-O sets the option, and + O cancels the setting. If no shopt_option is specified, the name and value of the shell option that can be accepted by shopt are printed on the standard output. If the call option is + O, the output format can be reused as input.

--

-- The symbol indicates the end of the option and cancels further option processing. All parameters after -- are considered as file names and parameters.


The first character of the logon shell parameter 0 is '-', or the shell called using the -- login option.
Interactive shell is a startup parameter with no option parameter. Unless the-s parameter is specified and the-c option is not specified, its input and output all point to the terminal (determined by isatty (3 ), or start with the-I option. For more information, see the interactive shell section.

If the option Processing Section is followed by a parameter without the-c or-s option, the first parameter is treated as a file name containing the shell command (see shell script ). When Bash is called in this way, $0 is set as the file name, and the location parameters are set as subsequent parameters. Bash reads and executes commands from this file, and then exits. Bash exit is the exit status of the last executed command in the script. If no command is executed, the exit status is 0.



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.