mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-12-12 08:33:45 +08:00
414d9a1eb1
When writing scripts for other shells, it can be confusing and annoying that our `man` function shadows other manual pages, for example `exec(1p)` from [Linux man-pages]. I almost never want to see the fish variant for such contended cases (which obviuosly don't include fish-specific commands like `string`, only widely-known shell builtins). For the contented cases like `exec`, the POSIX documentation is more substantial and useful, since it describes a (sub)set of languages widely used for scripting. Because of this I think we should stop overriding the system's man pages. Nowadays we offer `exec -h` as intuitive way to show the documentation for the fish-specific command (note that `help` is not a good replacement because it uses a web browser). Looking through the contended commands, it seems like for most of them, the fish version is not substantially different from the system version. A notable exception is `read` but I don't think it's a very important one. So I think we should can sacrifice a bit of the native fish-scripting experience in exchange for playing nicer with other shells. I think the latter is more important because scripting is not our focus, the way I see it. So maybe put our manpath at the end. In lieu of that, let's at least have `exec.rst` reference the system variant. [Linux man-pages]: https://www.kernel.org/doc/man-pages/ Closes #10376
58 lines
2.7 KiB
ReStructuredText
58 lines
2.7 KiB
ReStructuredText
.. _cmd-umask:
|
|
|
|
umask - set or get the file creation mode mask
|
|
==============================================
|
|
|
|
Synopsis
|
|
--------
|
|
|
|
.. synopsis::
|
|
|
|
umask [OPTIONS] [MASK]
|
|
|
|
|
|
Description
|
|
-----------
|
|
|
|
.. only:: builder_man
|
|
|
|
NOTE: This page documents the fish builtin ``umask``.
|
|
To see the documentation on any non-fish versions, use ``command man umask``.
|
|
|
|
``umask`` displays and manipulates the "umask", or file creation mode mask, which is used to restrict the default access to files.
|
|
|
|
The umask may be expressed either as an octal number, which represents the rights that will be removed by default, or symbolically, which represents the only rights that will be granted by default.
|
|
|
|
Access rights are explained in the manual page for the ``chmod(1)`` program.
|
|
|
|
With no parameters, the current file creation mode mask is printed as an octal number.
|
|
|
|
**-S** or **--symbolic**
|
|
Prints the umask in symbolic form instead of octal form.
|
|
|
|
**-p** or **--as-command**
|
|
Outputs the umask in a form that may be reused as input.
|
|
|
|
**-h** or **--help**
|
|
Displays help about using this command.
|
|
|
|
If a numeric mask is specified as a parameter, the current shell's umask will be set to that value, and the rights specified by that mask will be removed from new files and directories by default.
|
|
|
|
If a symbolic mask is specified, the desired permission bits, and not the inverse, should be specified. A symbolic mask is a comma separated list of rights. Each right consists of three parts:
|
|
|
|
- The first part specifies to whom this set of right applies, and can be one of ``u``, ``g``, ``o`` or ``a``, where ``u`` specifies the user who owns the file, ``g`` specifies the group owner of the file, ``o`` specific other users rights and ``a`` specifies all three should be changed.
|
|
|
|
- The second part of a right specifies the mode, and can be one of ``=``, ``+`` or ``-``, where ``=`` specifies that the rights should be set to the new value, ``+`` specifies that the specified right should be added to those previously specified and ``-`` specifies that the specified rights should be removed from those previously specified.
|
|
|
|
- The third part of a right specifies what rights should be changed and can be any combination of ``r``, ``w`` and ``x``, representing read, write and execute rights.
|
|
|
|
If the first and second parts are skipped, they are assumed to be ``a`` and ``=``, respectively. As an example, ``r,u+w`` means all users should have read access and the file owner should also have write access.
|
|
|
|
Note that symbolic masks currently do not work as intended.
|
|
|
|
|
|
Example
|
|
-------
|
|
|
|
``umask 177`` or ``umask u=rw`` sets the file creation mask to read and write for the owner and no permissions at all for any other users.
|