Contents
Is bash POSIX compatible?
bash supports a –posix switch, which makes it more POSIX-compliant. It also tries to mimic POSIX if invoked as sh .
What is bash POSIX mode?
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.
Which shells are POSIX-compliant?
As a second step, you can use a shell that is as compatible with POSIX as possible. One shell that is compatible with most other simple shells, is dash, Debian default system shell, which is a derivative of the older BSD ash. Another shell compatible with posix is posh.
What does POSIX mean in Linux?
Portable Operating System Interface
POSIX (Portable Operating System Interface) is a set of standard operating system interfaces based on the Unix operating system.
What does set in Bash do?
set allows you to change the values of shell options and set the positional parameters, or to display the names and values of shell variables.
How to make Bash conform to the POSIX standard?
Starting Bash with the –posix command-line option or executing ‘set -o posix’ while Bash is running will cause Bash to conform more closely to the POSIX standard by changing the behavior to match that specified by POSIX in areas where the Bash default differs. Thanks for contributing an answer to Stack Overflow!
How to make shell scripts POSIX compliant in Linux?
By default, it invokes sh, and, if installed, dash, bash, zsh, and ksh, but you can target any set of shells that you have installed by using the SHELLS environment variable. Using the example of the echo -n command on macOS to only target shells sh and bash:
Can a re match a string in POSIX 1003.2?
This is an extension, compatible with but not specified by POSIX 1003.2, and should be used with caution in soft- ware intended to be portable to other systems. In the event that an RE could match more than one substring of a given string, the RE matches the one starting earliest in the string.
Are there any obsolete res in POSIX 1003.2?
Obsolete REs mostly exist for backward compatibility in some old programs; they will be discussed at the end. 1003.2 leaves some aspects of RE syntax and semantics open; ` (!)’ marks decisions on these aspects that may not be fully portable to other 1003.2 implemen- tations.