unixdev.net


Switch to SpeakEasy.net DSL

The Modular Manual Browser

Home Page
Manual: (OSF1-V5.1-alpha)
Page:
Section:
Apropos / Subsearch:
optional field



umask(1)							     umask(1)



NAME

  umask	- Displays or sets the file mode creation mask

SYNOPSIS

  umask	[-S] [mask]

				     Note

       The C shell has a built-in version of the umask command.	 If you	are
       using the C shell, and want to guarantee	that you are using the com-
       mand described here, you	must specify the full path /usr/bin/umask.
       See the csh(1) reference	page for a description of the built-in com-
       mand.

STANDARDS

  Interfaces documented	on this	reference page conform to industry standards
  as follows:

  umask:  XCU5.0

  Refer	to the standards(5) reference page for more information	about indus-
  try standards	and associated tags.

OPTIONS

  -S  Produce symbolic output.

      Output is	produced in a format that is recognized	on a subsequent	invo-
      cation of	umask as a mask	operand	to restore the previous	file mode
      creation mask.

  If the -S option is not used,	output is displayed as an octal	integer, but
  is still usable as input on a	subsequent invocation of the umask command.

OPERANDS

  mask
      A	string specifying the new file mode creation mask. This	string may
      may be an	octal value or a symbolic_mode value.

      For a symbolic_mode value, the new value of the file mode	creation mask
      is 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 characters + and - are interpreted rela-
      tive to the current file mode creation mask; + causes the	bits for the
      indicated	permissions to be cleared in the mask; - causes	the bits for
      the indicated permissions	to be set in the mask.

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

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




DESCRIPTION

  The umask command sets the  file mode	 creation mask of the current shell
  execution environment	to the value specified	by the mask operand. This
  mask affects the initial value of the	file permission	bits of	subsequently
  created files.

  If the mask operand is not specified,	the umask command writes the value of
  the invoking process's file mode creation mask to standard output.

  If the -S option is specified, the output is in the following	format:

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

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

NOTES

   1.  Any mask	operand	such as	-r, -w,	-x, or anything	beginning with a
       hyphen, must be preceded	by -- to keep it from being interpreted	as a
       option.

   2.  Since umask affects the current shell execution environment, it is
       provided	as a shell regular built-in.

   3.  In contrast to the negative permission logic provided by	the file mode
       creation	mask and the octal number form of the mask argument, the sym-
       bolic form of the mask operand specifies	those permissions that are
       left alone.

   4.  Although	the references to octal	modes are obsolescent in the ISO/IEC
       9945-2:1993 standard, they are maintained for portable applications
       until further notice.

RESTRICTIONS

  If umask is called in	a subshell or separate utility execution environment,
  it does not affect the file mode creation mask of the	caller's environment.
  A separate execution environment could be one	of the following:

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

EXIT STATUS

  The following	exit values are	returned:

  0   The file mode creation mask was successfully changed, or no mask
      operand was supplied.

  >&gt;0  An error occurred.





EXAMPLES

   1.  To set the file mode creation mask so that subsequently created files
       have their write	by all others bit cleared, enter either	of the fol-
       lowing commands:
	    umask a=rx,ug+w
	    umask 002

   2.  If the file mode	creation mask was set with either of the above com-
       mands, the umask	command	can be used to write out the current value of
       the mask.  To write the value in	octal format, enter:
	    umask

       This provides the output:
	    0002

       To write	the value in symbolic format, enter:
	    umask -S

       This provides the output:
	    u=rwx,g=rwx,o=rx

   3.  The following sequence of commands is an	example	of how to save the
       current file mode creation mask and later restore the value using the
       umask command and octal integer formats.

	a.  Examine the	current	value of the mask:
		 umask

	    The	current	mask is	reported as:
		 022

	b.  Save the current value, and	verify the saved value:
		 SAVEMASK  =`umask`
		 echo $SAVEMASK

	    The	saved value is reported	as:
		 022

	c.  Change the current mask:
		 umask 444

	d.  Verify the change:
		 umask

	e.  The	new mask is reported:
		 0444

	f.  Restore the	previous mask:
		 umask $SAVEMASK

	g.  Verify the restored	value:
		 umask

	    The	value is now restored:
		 022



   4.  The following sequence of commands is an	example	of how to save the
       current file mode creation mask and later restore the value using the
       umask command and symbolic_mode formats.

	a.  Examine the	current	value of the mask:
		 umask -S

	    The	current	mask is	reported as:
		 u=rwx,g=rx,o=rx

	b.  Save the current value, and	verify the saved value:
		 SAVEMASK=`umask -S`
		 echo $SAVEMASK

	    The	saved value is reported	as:
		 u=rwx,g=rx,o=rx

	c.  Change the current mask:
		 umask a=

	d.  Verify the change:
		 umask -S

	e.  The	new mask is reported:
		 u=,g=,o=

	f.  Restore the	previous mask:
		 umask $SAVEMASK

	g.  Verify the restored	value:
		 umask -S

	    The	value is now restored:
		 u=rwx,g=rx,o=rx



   5.  To set the file mode creation mask so that subsequently created files
       have all	their write bits cleared, enter:
	    umask -- -w



ENVIRONMENT VARIABLES

  The following	environment variables affect the execution of umask:

  LANG
      Provides a default value for the internationalization variables that
      are unset	or null. If LANG is unset or null, the corresponding value
      from the default locale is used.	If any of the internationalization
      variables	contain	an invalid setting, the	utility	behaves	as if none of
      the variables had	been defined.

  LC_ALL
      If set to	a non-empty string value, overrides the	values of all the
      other internationalization variables.

  LC_CTYPE
      Determines 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
      Determines the locale for	the format and contents	of diagnostic mes-
      sages written to standard	error.

  NLSPATH
      Determines the location of message catalogues for	the processing of
      LC_MESSAGES.



SEE ALSO

  Commands:  chmod(1)


  Functions:  chmod(2),	umask(2)

  Standards:  standards(5)