Unix shell

Arithmetic expansion

Required by Posix. Integer arithmetic on C signed long (or higher rank) values. Includes assignment operators, but may be limited to assigning to variables that were previoiusly unset. Excludes increment and decrement operators, and the comma operator. Includes decimal, hexadecimal, and octal constants. The expression can include parameter (and other) expansions.

Redirections

Unix Base Specifications, Issue 7, ยง2.7 Redirection

Any file descriptor must immediately precede the redirection symbol, with no intervening space. The argument following the redirection is considered a separate word an may be preceded by intervening space. Space is often used for file redirections and here documents, but rarely for redirecting with a duplicated file descriptor or closing a file descriptor. By default, input and output redirections respectively apply to standard input and output.

File descriptors

Redirection types

Redirection order

Each redirection is effectively applied to temporary file descriptors in the order given. The first line redirects stdout to null and then also redirects stderr there. The second line redirects stderr to the original stdout target, but then redirects the actual stdout to null.

> /dev/null 2>&1
2>&1 > /dev/null