I want to execute one command and I want that it is executed with a specific groupname, that I'm belonging to, but which is not my default group. So all files created will belong to that group.
Is there a command for that?
There is
chgrp
to fix it afterwards.
Then I found newgrp
(https://unix.stackexchange.com/questions/23093/changing-my-default-primary-gid-for-every-login-session) , but that creates a subshell. Thus a oneliner newgroup && cmd
does not work. And the shell needs to be closed later.
Both approaches looks error prone.
Asked by Friedrich -- Слава Україні
(123 rep)
May 20, 2022, 03:52 PM
Last activity: Jan 27, 2024, 08:44 PM
Last activity: Jan 27, 2024, 08:44 PM