Differences between revisions 7 and 13 (spanning 6 versions)
Revision 7 as of 2017-10-19 23:39:38
Size: 296
Comment:
Revision 13 as of 2017-10-20 04:29:26
Size: 910
Comment:
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
<<TableOfContents>> ||||<tablewidth="100%"style="text-align:left">~+GNU '''__B__'''ourne-'''__A__'''gain __'''SH'''__ell+~ ||
||<99% style="vertical-align:top;text-align:center"><<Include(/description)>> <<Include(/invocation, "Invocation", 2, from="^----$")>> <<Include(/statement, "Statements", 2, from="^----$")>> <<Include(/builtin, "Builtin Commands", 2, from="^----$")>> <<Include(/syntax, "Syntax", 2, from="^----$")>> <<Include(/execution, "Execution", 2, from="^----$")>> ||<style="text-align:right"><<TableOfContents>> ||
Line 3: Line 4:
= BASH =
GNU - __B__ourne-__A__gain __SH__ell
Line 6: Line 5:
[[/execution]] [[bash/description]]
Line 9: Line 9:

----
<<Include(/statement, "Statements", 2, from="^----$")>>

----
<<Include(/builtin, "Builtin Commands", 2, from="^----$")>>
Line 11: Line 18:
Line 13: Line 21:
Line 14: Line 23:
== Readline ==
----

GNU Bourne-Again SHell

Bash is a POSIX shell (sh(1) compatible) command interpreter. Many useful features have been added with inspiration drawn from the Korn & C shells. New and unique extensions are occasionally added to the shell. There is also support for custom run-time extensions via the enable builtin command. Bash may be compiled to be POSIX compliant by default as specified by the Shell and Utilities portion of the POSIX specification (IEEE Standard 1003.1).

1. Invocation

2. Modes

GNU bash may be started in any combination of various invocation modes. These modes control:

  • The source from which to interpenetrate commands:
    • user's terminal
    • shell script
    • command string
    • file contents
    • standard input
  • POSIX compatibality
  • Login shell mode
  • Security settings
  • Restricted Shell access

/InteractiveShell

3. Interactive Shell

4. Login Shell

  • Login Shell

5. POSIX Mode

6. Command String

7. Interactive Shell

7.1. Command Line

7.2. Prompting

7.3. Completion

7.4. History

7.5. Job Control

8. Shell Script

9. Command File

10. Command Stream

11. Restricted Shell



CategoryBashRef

12. Options

12.1. -c CommandString

-c [options] -- CommandString [ARG0 [ARG...]]

  • commands are read from the first non-option argument (required)
  • $0 is set as the second non-option argument defaulting to "bash"

  • all remaining non-option arguments are assigned to the positional parameters starting at $1

  • [[ $- =~ c ]] will return true

12.2. -i

-i [options]

  • force the shell into Interactive Mode

  • [[ $- =~ i ]] will return true

  • [[ ${PS1+set} = 'set' ]] will return true

Include: Nothing found for "^----$"!

12.3. -l

pragma section-numbers 1

12.4. Invocation Option l


-l | --login

  • act as a Login Shell

  • --login must appear on the command line before the single-character options to be recognized.

12.5. -r

-r

12.6. -s

-s [options] -- [ARG0 [ARG...]]

12.7. -D

-D | --dump-strings

  • A list of all double-quoted strings preceded by $ is printed on the standard output. These are the strings that are subject to language translation when the current locale is not C or POSIX. This implies the -n option; no commands will be executed.

12.8. -O ShoptOption | +O ShoptOption

-O ShoptOption | +O ShoptOption

  • shopt_option is one of the shell options accepted by the shopt builtin (see SHELL BUILTIN COMMANDS below).
  • If shopt_option is present, -O sets the value of that option; +O unsets it.
  • If shopt_option is not supplied, the names and values of the shell options accepted by shopt are printed on the standard output.
  • If the invocation option is +O, the output is displayed in a format that may be reused as input.

12.9. --debugger

--debugger

  • Arrange for the debugger profile to be executed before the shell starts.
  • Turns on extended debugging mode (see the description of the extdebug option to the shopt builtin below).
  • These options must appear on the command line before the single-character options to be recognized.

12.10. --dump-po-strings

--dump-po-strings

  • Equivalent to -D, but the output is in the GNU gettext po (portable object) file format.
  • These options must appear on the command line before the single-character options to be recognized.

12.11. --dump-strings

-D | --dump-strings

  • A list of all double-quoted strings preceded by $ is printed on the standard output. These are the strings that are subject to language translation when the current locale is not C or POSIX. This implies the -n option; no commands will be executed.

12.12. --help

--help

  • Display a usage message on standard output and exit successfully.
  • These options must appear on the command line before the single-character options to be recognized.

Include: Nothing found for "^----$"!

12.13. --init-file

12.14. Invocation Option --rcfile


--rcfile FILE | --init-file FILE

  • Execute commands from file instead of the standard personal initialization file ~/.bashrc if the shell is interactive (see INVOCATION below).
  • An argument of --init-file is equivalent to --rcfile.
  • These options must appear on the command line before the single-character options to be recognized.

12.15. --rcfile

--rcfile FILE | --init-file FILE

  • Execute commands from file instead of the standard personal initialization file ~/.bashrc if the shell is interactive (see INVOCATION below).
  • An argument of --init-file is equivalent to --rcfile.
  • These options must appear on the command line before the single-character options to be recognized.

12.16. --login

-l | --login

  • act as a Login Shell

  • --login must appear on the command line before the single-character options to be recognized.

12.17. --noediting

--noediting

  • Do not use the GNU readline library to read command lines when the shell is interactive.
  • These options must appear on the command line before the single-character options to be recognized.

12.18. --noprofile

--noprofile

  • Do not read either the system-wide startup file /etc/profile or any of the personal initialization files ~/.bash_profile, ~/.bash_login, or ~/.profile.
  • By default, bash reads these files when it is invoked as a login shell (see INVOCATION below).
  • These options must appear on the command line before the single-character options to be recognized.

12.19. --norc

--norc

  • Do not read and execute the personal initialization file ~/.bashrc if the shell is interactive.
  • This option is on by default if the shell is invoked as sh.
  • These options must appear on the command line before the single-character options to be recognized.

12.20. --posix

--posix

  • Change the behavior of bash where the default operation differs from the POSIX standard to match the standard (posix mode).
  • See SEE ALSO below for a reference to a document that details how posix mode affects bash's behavior.
  • These options must appear on the command line before the single-character options to be recognized.

12.21. --restricted

13. Environment

14. Files

14.1. Bash Binary

14.2. /etc/profile

14.3. ~/.bash_profile

14.4. ~/.bashrc

14.5. ~/.profile

14.6. ~/.bash_logout

14.7. ~/.inputrc

15. Statements

Also called "Compound Commands".

15.1. while

15.2. for in

15.3. for

15.4. if

15.5. case

15.6. until

15.7. group

15.8. subshell

15.9. Conditional

15.10. Arithmetic

15.11. select

15.12. coprocess

15.13. Function Definition

16. Builtin Commands

16.1. : (colon)

17. Syntax

17.1. Alias

17.2. Expansion

17.3. Redirection

17.4. Comment

17.5. List

17.6. Pipeline

17.7. Simple Command

17.8. Metacharacter

17.9. Reserved Words

17.10. Compound Command

17.11. Coprocess

17.12. Function Definition

17.13. Functions

17.14. Arithmetic Evaluation

17.15. Conditional Expressions

18. Execution

18.1. Environment

18.2. Parameters

18.3. Working Directory

18.4. Functions

18.5. Open Files

18.6. Traps

18.7. umask

18.8. Options

18.9. Alias

18.10. OS process context

18.11. Exit Status

19. Subshell

Contents

  1. Invocation
    1. Modes
      1. Interactive Shell
      2. Login Shell
      3. POSIX Mode
      4. Command String
      5. Interactive Shell
        1. Command Line
        2. Prompting
        3. Completion
        4. History
        5. Job Control
      6. Shell Script
      7. Command File
      8. Command Stream
      9. Restricted Shell
    2. Options
      1. -c CommandString
      2. -i
      3. -l
      4. Invocation Option l
      5. -r
      6. -s
      7. -D
      8. -O ShoptOption | +O ShoptOption
      9. --debugger
      10. --dump-po-strings
      11. --dump-strings
      12. --help
      13. --init-file
      14. Invocation Option --rcfile
      15. --rcfile
      16. --login
      17. --noediting
      18. --noprofile
      19. --norc
      20. --posix
      21. --restricted
    3. Environment
    4. Files
      1. Bash Binary
      2. /etc/profile
      3. ~/.bash_profile
      4. ~/.bashrc
      5. ~/.profile
      6. ~/.bash_logout
      7. ~/.inputrc
  2. Statements
    1. while
    2. for in
    3. for
    4. if
    5. case
    6. until
    7. group
    8. subshell
    9. Conditional
    10. Arithmetic
    11. select
    12. coprocess
    13. Function Definition
  3. Builtin Commands
    1. : (colon)
  4. Syntax
    1. Alias
    2. Expansion
    3. Redirection
    4. Comment
    5. List
    6. Pipeline
    7. Simple Command
    8. Metacharacter
    9. Reserved Words
    10. Compound Command
    11. Coprocess
    12. Function Definition
    13. Functions
    14. Arithmetic Evaluation
    15. Conditional Expressions
  5. Execution
    1. Environment
    2. Parameters
    3. Working Directory
    4. Functions
    5. Open Files
    6. Traps
    7. umask
    8. Options
    9. Alias
    10. OS process context
    11. Exit Status
  6. Subshell
  7. Invocation
    1. Modes
      1. Interactive Shell
      2. Login Shell
      3. POSIX Mode
      4. Command String
      5. Interactive Shell
        1. Command Line
        2. Prompting
        3. Completion
        4. History
        5. Job Control
      6. Shell Script
      7. Command File
      8. Command Stream
      9. Restricted Shell
    2. Options
      1. -c CommandString
      2. -i
      3. -l
      4. Invocation Option l
      5. -r
      6. -s
      7. -D
      8. -O ShoptOption | +O ShoptOption
      9. --debugger
      10. --dump-po-strings
      11. --dump-strings
      12. --help
      13. --init-file
      14. Invocation Option --rcfile
      15. --rcfile
      16. --login
      17. --noediting
      18. --noprofile
      19. --norc
      20. --posix
      21. --restricted
    3. Environment
    4. Files
      1. Bash Binary
      2. /etc/profile
      3. ~/.bash_profile
      4. ~/.bashrc
      5. ~/.profile
      6. ~/.bash_logout
      7. ~/.inputrc
  8. Statements
    1. while
    2. for in
    3. for
    4. if
    5. case
    6. until
    7. group
    8. subshell
    9. Conditional
    10. Arithmetic
    11. select
    12. coprocess
    13. Function Definition
  9. Builtin Commands
    1. : (colon)
  10. Syntax
    1. Alias
    2. Expansion
    3. Redirection
    4. Comment
    5. List
    6. Pipeline
    7. Simple Command
    8. Metacharacter
    9. Reserved Words
    10. Compound Command
    11. Coprocess
    12. Function Definition
    13. Functions
    14. Arithmetic Evaluation
    15. Conditional Expressions
  11. Execution
    1. Environment
    2. Parameters
    3. Working Directory
    4. Functions
    5. Open Files
    6. Traps
    7. umask
    8. Options
    9. Alias
    10. OS process context
    11. Exit Status
  12. Subshell
  13. Readline

bash/description


20. Invocation

20.1. Modes

GNU bash may be started in any combination of various invocation modes. These modes control:

  • The source from which to interpenetrate commands:
    • user's terminal
    • shell script
    • command string
    • file contents
    • standard input
  • POSIX compatibality
  • Login shell mode
  • Security settings
  • Restricted Shell access

/InteractiveShell

20.1.1. Interactive Shell

20.1.2. Login Shell

  • Login Shell

20.1.3. POSIX Mode

20.1.4. Command String

20.1.5. Interactive Shell

20.1.5.1. Command Line

20.1.5.2. Prompting

20.1.5.3. Completion

20.1.5.4. History

20.1.5.5. Job Control

20.1.6. Shell Script

20.1.7. Command File

20.1.8. Command Stream

20.1.9. Restricted Shell



CategoryBashRef

20.2. Options

20.2.1. -c CommandString

-c [options] -- CommandString [ARG0 [ARG...]]

  • commands are read from the first non-option argument (required)
  • $0 is set as the second non-option argument defaulting to "bash"

  • all remaining non-option arguments are assigned to the positional parameters starting at $1

  • [[ $- =~ c ]] will return true

20.2.2. -i

-i [options]

  • force the shell into Interactive Mode

  • [[ $- =~ i ]] will return true

  • [[ ${PS1+set} = 'set' ]] will return true

Include: Nothing found for "^----$"!

20.2.3. -l

pragma section-numbers 1

20.2.4. Invocation Option l


-l | --login

  • act as a Login Shell

  • --login must appear on the command line before the single-character options to be recognized.

20.2.5. -r

-r

20.2.6. -s

-s [options] -- [ARG0 [ARG...]]

20.2.7. -D

-D | --dump-strings

  • A list of all double-quoted strings preceded by $ is printed on the standard output. These are the strings that are subject to language translation when the current locale is not C or POSIX. This implies the -n option; no commands will be executed.

20.2.8. -O ShoptOption | +O ShoptOption

-O ShoptOption | +O ShoptOption

  • shopt_option is one of the shell options accepted by the shopt builtin (see SHELL BUILTIN COMMANDS below).
  • If shopt_option is present, -O sets the value of that option; +O unsets it.
  • If shopt_option is not supplied, the names and values of the shell options accepted by shopt are printed on the standard output.
  • If the invocation option is +O, the output is displayed in a format that may be reused as input.

20.2.9. --debugger

--debugger

  • Arrange for the debugger profile to be executed before the shell starts.
  • Turns on extended debugging mode (see the description of the extdebug option to the shopt builtin below).
  • These options must appear on the command line before the single-character options to be recognized.

20.2.10. --dump-po-strings

--dump-po-strings

  • Equivalent to -D, but the output is in the GNU gettext po (portable object) file format.
  • These options must appear on the command line before the single-character options to be recognized.

20.2.11. --dump-strings

-D | --dump-strings

  • A list of all double-quoted strings preceded by $ is printed on the standard output. These are the strings that are subject to language translation when the current locale is not C or POSIX. This implies the -n option; no commands will be executed.

20.2.12. --help

--help

  • Display a usage message on standard output and exit successfully.
  • These options must appear on the command line before the single-character options to be recognized.

Include: Nothing found for "^----$"!

20.2.13. --init-file

20.2.14. Invocation Option --rcfile


--rcfile FILE | --init-file FILE

  • Execute commands from file instead of the standard personal initialization file ~/.bashrc if the shell is interactive (see INVOCATION below).
  • An argument of --init-file is equivalent to --rcfile.
  • These options must appear on the command line before the single-character options to be recognized.

20.2.15. --rcfile

--rcfile FILE | --init-file FILE

  • Execute commands from file instead of the standard personal initialization file ~/.bashrc if the shell is interactive (see INVOCATION below).
  • An argument of --init-file is equivalent to --rcfile.
  • These options must appear on the command line before the single-character options to be recognized.

20.2.16. --login

-l | --login

  • act as a Login Shell

  • --login must appear on the command line before the single-character options to be recognized.

20.2.17. --noediting

--noediting

  • Do not use the GNU readline library to read command lines when the shell is interactive.
  • These options must appear on the command line before the single-character options to be recognized.

20.2.18. --noprofile

--noprofile

  • Do not read either the system-wide startup file /etc/profile or any of the personal initialization files ~/.bash_profile, ~/.bash_login, or ~/.profile.
  • By default, bash reads these files when it is invoked as a login shell (see INVOCATION below).
  • These options must appear on the command line before the single-character options to be recognized.

20.2.19. --norc

--norc

  • Do not read and execute the personal initialization file ~/.bashrc if the shell is interactive.
  • This option is on by default if the shell is invoked as sh.
  • These options must appear on the command line before the single-character options to be recognized.

20.2.20. --posix

--posix

  • Change the behavior of bash where the default operation differs from the POSIX standard to match the standard (posix mode).
  • See SEE ALSO below for a reference to a document that details how posix mode affects bash's behavior.
  • These options must appear on the command line before the single-character options to be recognized.

20.2.21. --restricted

20.3. Environment

20.4. Files

20.4.1. Bash Binary

20.4.2. /etc/profile

20.4.3. ~/.bash_profile

20.4.4. ~/.bashrc

20.4.5. ~/.profile

20.4.6. ~/.bash_logout

20.4.7. ~/.inputrc


21. Statements

Also called "Compound Commands".

21.1. while

21.2. for in

21.3. for

21.4. if

21.5. case

21.6. until

21.7. group

21.8. subshell

21.9. Conditional

21.10. Arithmetic

21.11. select

21.12. coprocess

21.13. Function Definition


22. Builtin Commands

22.1. : (colon)


23. Syntax

23.1. Alias

23.2. Expansion

23.3. Redirection

23.4. Comment

23.5. List

23.6. Pipeline

23.7. Simple Command

23.8. Metacharacter

23.9. Reserved Words

23.10. Compound Command

23.11. Coprocess

23.12. Function Definition

23.13. Functions

23.14. Arithmetic Evaluation

23.15. Conditional Expressions


24. Execution

24.1. Environment

24.2. Parameters

24.3. Working Directory

24.4. Functions

24.5. Open Files

24.6. Traps

24.7. umask

24.8. Options

24.9. Alias

24.10. OS process context

24.11. Exit Status

25. Subshell


26. Readline


CategoryBashRef

bash (last edited 2017-10-20 15:44:44 by Robert Robertson)