NAME
umask - get or set the file mode creation mask
SYNOPSIS
umask [-S][mask]

DESCRIPTION
The umask utility shall set the file mode creation mask of the current shell execution environment (see Shell Execution Environment ) to the value specified by the mask operand. This mask shall affect the initial value of the file permission bits of subsequently created files. If umask is called in a subshell or separate utility execution environment, such as one of the following:

(umask 002)
nohup umask ...
find . -exec umask ... \;

it shall not affect the file mode creation mask of the caller's environment.

If the mask operand is not specified, the umask utility shall write to standard output the value of the invoking process' file mode creation mask.

OPTIONS
The umask utility shall conform to the Base Definitions volume of IEEE Std 1003.1-2001, Section 12.2, Utility Syntax Guidelines.

The following option shall be supported:

-S
Produce symbolic output.
The default output style is unspecified, but shall be recognized on a subsequent invocation of umask on the same system as a mask operand to restore the previous file mode creation mask.

OPERANDS
The following operand shall be supported:

mask
A string specifying the new file mode creation mask. The string is treated in the same way as the mode operand described in the EXTENDED DESCRIPTION section for chmod.
For a symbolic_mode value, the new value of the file mode creation mask shall be the logical complement of the file permission bits portion of the file mode specified by the symbolic_mode string.

In a symbolic_mode value, the permissions op characters '+' and '-' shall be interpreted relative to the current file mode creation mask; '+' shall cause the bits for the indicated permissions to be cleared in the mask; '-' shall cause the bits for the indicated permissions to be set in the mask.

The interpretation of mode values that specify file mode bits other than the file permission bits is unspecified.

In the octal integer form of mode, the specified bits are set in the file mode creation mask.

The file mode creation mask shall be set to the resulting numeric value.

The default output of a prior invocation of umask on the same system with no operand also shall be recognized as a mask operand.


STDIN
Not used.

INPUT FILES
None.

ENVIRONMENT VARIABLES
The following environment variables shall affect the execution of umask:

LANG
Provide a default value for the internationalization variables that are unset or null. (See the Base Definitions volume of IEEE Std 1003.1-2001, Section 8.2, Internationalization Variables for the precedence of internationalization variables used to determine the values of locale categories.)
LC_ALL
If set to a non-empty string value, override the values of all the other internationalization variables.
LC_CTYPE
Determine the locale for the interpretation of sequences of bytes of text data as characters (for example, single-byte as opposed to multi-byte characters in arguments).
LC_MESSAGES
Determine the locale that should be used to affect the format and contents of diagnostic messages written to standard error.
NLSPATH
Determine the location of message catalogs for the processing of LC_MESSAGES .
ASYNCHRONOUS EVENTS
Default.

STDOUT
When the mask operand is not specified, the umask utility shall write a message to standard output that can later be used as a umask mask operand.

If -S is specified, the message shall be in the following format:

"u=%s,g=%s,o=%s\n", <owner permissions>, <group permissions>,
<other permissions>

where the three values shall be combinations of letters from the set { r, w, x}; the presence of a letter shall indicate that the corresponding bit is clear in the file mode creation mask.

If a mask operand is specified, there shall be no output written to standard output.

STDERR
The standard error shall be used only for diagnostic messages.