Simple enough.I have user foo.foo belongs to groups foo (main), audio, A, B and common.Normally files are created with ownership foo.foo.For a while I would like foo to create files with group common.Basically I see it this way:Cache present groupChange group to *common*Touch alphaTouch beta ...Change group back.alpha beta ( and anything after ) should be created with owner foo.common.How can I accomplish this?PS:Oops. Forgot to say that I want to do this in both bash and zsh.
Changing group in shell
files;group;access control
Neither bash nor zsh has this functionality.You can call newgrp. This is an external command, which starts a new process. It runs the program indicated by the SHELL environment variable with no arguments.newgrp common <<EOStouch alpha betaEOStouch belongs_to_original_groupNote that since newgrp starts a new shell, it doesn't inherit from the shell variables of the original shell, only from environment (exported) variables. Any assignments performed there will take effect only there.