| 6.11 Bash POSIX Mode |
| ==================== |
|
|
| Starting Bash with the |
| -o posix |
| to the POSIX standard by changing the behavior to match that specified |
| by POSIX in areas where the Bash default differs. |
|
|
| When invoked as |
| files. |
|
|
| The following list is what |
|
|
| 1. Bash ensures that the |
|
|
| 2. When a command in the hash table no longer exists, Bash will |
| re-search |
| with |
|
|
| 3. Bash will not insert a command without the execute bit set into the |
| command hash table, even if it returns it as a (last-ditch) result |
| from a |
|
|
| 4. The message printed by the job control code and builtins when a job |
| exits with a non-zero status is |
|
|
| 5. The message printed by the job control code and builtins when a job |
| is stopped is |
| |
|
|
| 6. Alias expansion is always enabled, even in non-interactive shells. |
|
|
| 7. Reserved words appearing in a context where reserved words are |
| recognized do not undergo alias expansion. |
|
|
| 8. Alias expansion is performed when initially parsing a command |
| substitution. The default mode generally defers it, when enabled, |
| until the command substitution is executed. This means that |
| command substitution will not expand aliases that are defined after |
| the command substitution is initially parsed (e.g., as part of a |
| function definition). |
|
|
| 9. The POSIX |
| and |
| on the values of |
| |
|
|
| 10. The POSIX startup files are executed ( |
| normal Bash files. |
|
|
| 11. Tilde expansion is only performed on assignments preceding a |
| command name, rather than on all assignment statements on the line. |
|
|
| 12. The default history file is |
| value of |
|
|
| 13. Redirection operators do not perform filename expansion on the |
| word in the redirection unless the shell is interactive. |
|
|
| 14. Redirection operators do not perform word splitting on the word in |
| the redirection. |
|
|
| 15. Function names must be valid shell |
| contain characters other than letters, digits, and underscores, and |
| may not start with a digit. Declaring a function with an invalid |
| name causes a fatal syntax error in non-interactive shells. |
|
|
| 16. Function names may not be the same as one of the POSIX special |
| builtins. |
|
|
| 17. POSIX special builtins are found before shell functions during |
| command lookup. |
|
|
| 18. When printing shell function definitions (e.g., by |
| does not print the |
|
|
| 19. Literal tildes that appear as the first character in elements of |
| the |
| Tilde Expansion::. |
|
|
| 20. The |
| used in this way, it displays timing statistics for the shell and |
| its completed children. The |
| format of the timing information. |
|
|
| 21. When parsing and expanding a ${...} expansion that appears within |
| double quotes, single quotes are no longer special and cannot be |
| used to quote a closing brace or other special character, unless |
| the operator is one of those defined to perform pattern removal. |
| In this case, they do not have to appear as matched pairs. |
|
|
| 22. The parser does not recognize |
| next token begins with a |
|
|
| 23. The |
| double-quoted string, even if the |
|
|
| 24. If a POSIX special builtin returns an error status, a |
| non-interactive shell exits. The fatal errors are those listed in |
| the POSIX standard, and include things like passing incorrect |
| options, redirection errors, variable assignment errors for |
| assignments preceding the command name, and so on. |
|
|
| 25. A non-interactive shell exits with an error status if a variable |
| assignment error occurs when no command name follows the assignment |
| statements. A variable assignment error occurs, for example, when |
| trying to assign a value to a readonly variable. |
|
|
| 26. A non-interactive shell exits with an error status if a variable |
| assignment error occurs in an assignment statement preceding a |
| special builtin, but not with any other simple command. For any |
| other simple command, the shell aborts execution of that command, |
| and execution continues at the top level ("the shell shall not |
| perform any further processing of the command in which the error |
| occurred"). |
|
|
| 27. A non-interactive shell exits with an error status if the |
| iteration variable in a |
| in a |
|
|
| 28. Non-interactive shells exit if FILENAME in |
| found. |
|
|
| 29. Non-interactive shells exit if a syntax error in an arithmetic |
| expansion results in an invalid expression. |
|
|
| 30. Non-interactive shells exit if a parameter expansion error occurs. |
|
|
| 31. Non-interactive shells exit if there is a syntax error in a script |
| read with the |
| the |
|
|
| 32. While variable indirection is available, it may not be applied to |
| the |
|
|
| 33. Expanding the |
| expansion is double-quoted does not treat the |
| double-quoted. |
|
|
| 34. Assignment statements preceding POSIX special builtins persist in |
| the shell environment after the builtin completes. |
|
|
| 35. The |
| assignment statements as arguments from expanding them as |
| assignment statements; when not in POSIX mode, assignment builtins |
| lose their assignment statement expansion properties when preceded |
| by |
|
|
| 36. The |
| placed in the background, which does not include an indication of |
| whether the job is the current or previous job. |
|
|
| 37. The output of |
| line, separated by spaces, without the |
|
|
| 38. The |
| prefix. |
|
|
| 39. The |
| in the format required by POSIX. |
|
|
| 40. The |
| |
|
|
| 41. The |
| signal specification and revert the signal handling to the original |
| disposition if it is, unless that argument consists solely of |
| digits and is a valid signal number. If users want to reset the |
| handler for a given signal to the original disposition, they should |
| use |
|
|
| 42. |
| and those that were ignored when the shell started. |
|
|
| 43. The |
| for the filename argument if it is not found by searching |
|
|
| 44. Enabling POSIX mode has the effect of setting the |
| |
| substitutions inherit the value of the |
| shell. When the |
| clears the |
|
|
| 45. Enabling POSIX mode has the effect of setting the |
| option, so numeric arguments to |
| positional parameters will result in an error message. |
|
|
| 46. When the |
| display them with a leading |
| supplied. |
|
|
| 47. When the |
| display shell function names and definitions. |
|
|
| 48. When the |
| variable values without quotes, unless they contain shell |
| metacharacters, even if the result contains nonprinting characters. |
|
|
| 49. When the |
| constructed from |
| argument does not refer to an existing directory, |
| instead of falling back to physical mode. |
|
|
| 50. When the |
| of the pathname constructed from |
| supplied as an argument exceeds |
| are expanded, |
| supplied directory name. |
|
|
| 51. The |
| the current directory, even if it is not asked to check the file |
| system with the |
|
|
| 52. When listing the history, the |
| indication of whether or not a history entry has been modified. |
|
|
| 53. The default editor used by |
|
|
| 54. The |
| file as having been found, though the shell will attempt to execute |
| such a file if it is the only so-named file found in |
|
|
| 55. The |
| the |
| |
|
|
| 56. When the |
| interpret any arguments to |
| displayed, after escape characters are converted. |
|
|
| 57. The |
| and |
|
|
| 58. The arrival of |
| interrupt the |
| The trap command is run once for each child that exits. |
|
|
| 59. The |
| has been set. If Bash receives a trapped signal while executing |
| |
| greater than 128. |
|
|
| 60. The |
| arguments corresponding to floating point conversion specifiers, |
| instead of |
| modifier forces |
|
|
| 61. Bash removes an exited background process |
| of such statuses after the |
|
|
| There is other POSIX behavior that Bash does not implement by default |
| even when in POSIX mode. Specifically: |
|
|
| 1. The |
| entries if |
| |
|
|
| 2. As noted above, Bash requires the |
| for the |
|
|
| Bash can be configured to be POSIX-conformant by default, by specifying |
| the |
| Optional Features::). |
|
|
|
|