If mask is an octal integer, only the low-order 9 bits are used. The value of each specified digit is ``subtracted'' from the corresponding ``digit'' in the new files' permissions (see umask(S-osr5) or creat(S-osr5) for details).
Every octal digit can be represented by three bits; an octal integer used by umask consists of three digits (or nine bits). Each bit corresponds to a permission which may be applied to a file when it is created, and each octal digit corresponds to one of the ``owner'', ``group'' and ``other'' permission groups. Thus, the octal digit for ``owner'' permissions can contain any combination of three bits, which are used to set ``read'', ``write'' and ``execute'' permissions.
The value of each specified digit is subtracted from the corresponding digit specified by the system for the creation of any file (see umask(S-osr5) or ).creat(S-osr5)
If a given mode bit in mask has the value ``1'', then that permission will be removed from the file; if the mode bit has the value ``0'', it has no effect.
For example, umask 022 removes group and others write permission (files normally created with mode 777 become mode 755; files created with mode 666 become mode 644).
If mask is a symbolic mode string the new value of the file mode creation mask is the logical complement of the file specified permission bits.
If you omit the mask operand, the shell prints the current value of the mask. By default, the shell prints the mask in octal form; specifying the -S option outputs the mask in symbolic form.
umask is built into csh, ksh, and sh.
The following command sets the mask to clear the execute bits for
all files created subsequently:
umask -- -x
Note that the ``--'' is necessary to prevent the shell interpreting -x as an option.
ISO/IEC DIS 99452:1992, Information technology Portable Operating System Interface (POSIX) Part 2: Shell and Utilities (IEEE Std 1003.21992);
AT&T SVID Issue 2;
X/Open CAE Specification, Commands and Utilities, Issue 4, 1992.