Earlier quoted context omitted.
Bash actually has a POSIX compatibility mode. There is a great deal in POSIX that was not in Bourne, native arithmetic expressions being the first to come to mind, then new-style command substitution. https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V... All of the POSIX utility standards, including the grep variants, can be found in the URL's parent directory: https://pubs.opengroup.org/onlinepubs/96999197…
> Bash actually has a POSIX compatibility mode. It's partial. A short example is `date&>FILE`. [edited typo] On a POSIX shell, `date` will run in the background and the date will be written to stdout (`date&`) and `FILE` will be created or truncated (`>FILE`). Using `bash --posix`, the date will be written to `FILE`, since the incompatible bashism `&>` still takes priority.
If I were writing such a script where I wanted to launch a background process, and then create/truncate a file, I myself would separate them:
date &
>FILE
Bash wouldn't mistake that, but a lot of shell scripts look like line noise and there are situations where bad form is required (quoted in an ssh, for example).Obviously, people wanting the bash functionality in POSIX would:
date > file 2>&1
Bash discourages the latter form in my man page, but anyone interested in portability knows how profoundly bad that advice is.