2

Plenty of examples on how to set umask for a user... but how do you read (or uncover) the default umask for a given user (say the logged in user)

  • Note that umask is not associated with a user but with a process. – Stéphane Chazelas Jan 28 '13 at 21:31
  • ic. so what I think I want, ideally, is for the umask to change to 002 whenever I run a particular command ($ brew …) but it can default back to 022 at all other times. possible or wishful thinking? – Meltemi Jan 28 '13 at 23:56
5

With the umask command...

dennis@lightning:~$ umask
0002
  • LOL- well, that was easy (read: obvious)! thx – Meltemi Jan 28 '13 at 21:25
1

To make sure a command is called with a specific command, you could wrap it inside a script or a function that starts a subshell with the umask updated. You could put that function definition in your shell configuration file like .bashrc for bash or .zshrc for zsh.

Something like:

brew() (
  umask 002 &&
    command brew "$@"
)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.