src.elv.sh@v0.21.0-dev.0.20240515223629-06979efb9a2a/pkg/mods/unix/umask.d.elv (about)

     1  # The [file mode creation mask](https://en.wikipedia.org/wiki/Umask) for the
     2  # process.
     3  #
     4  # Bits that are set in the mask get **cleared** in the actual permission of
     5  # newly created files: for example, a value of `0o022` causes the group write
     6  # and world write bits to be cleared when creating a new file.
     7  #
     8  # This variable has some special properties when read or assigned:
     9  #
    10  # -   When read, the value is a string in octal representation, like `0o027`.
    11  #
    12  # -   When assigned, both strings that parse as numbers and typed numbers may be
    13  #     specified as the new value, as long as the value is within the range [0,
    14  #     0o777].
    15  #
    16  #     As a special case for this variable, strings that don't start with `0b` or
    17  #     `0x` are treated as octal instead of decimal: for example, `set unix:umask
    18  #     = 27` is equivalent to `set unix:umask = 0o27` or `set unix:umask = (num
    19  #     0o27)`, and **not** the same as `set unix:umask = (num 27)`.
    20  #
    21  # You can do a temporary assignment to affect a single command, like
    22  # `{ tmp umask = 077; touch a_file }`, but beware that since umask applies to
    23  # the whole process, any code that runs in parallel (such as via
    24  # [`peach`]()) can also get affected.
    25  var umask