umask and shell script

umask and shell script

Post by drmwor.. » Fri, 24 Mar 2000 04:00:00



I'd like to make it easy for users to log into a
different group and to make sure that when they do
that any files that are then created have group
write permission by default.
I'm trying to do this with a simple shell script
that just does
newgrp thenewgroup
umask 002
If I (or users) do this interactively, it works
fine. However, the umask doesn't stick around when
executed from the shell script (reverts to 002). I
suspect that the umask is only good for the life of
the child process that is running the script (?).
Any ideas how to make this work?
Thanks,
Mike

Sent via Deja.com http://www.deja.com/
Before you buy.

 
 
 

umask and shell script

Post by Willem Vermeule » Fri, 24 Mar 2000 04:00:00



Quote:> I'd like to make it easy for users to log into a
> different group and to make sure that when they do
> that any files that are then created have group
> write permission by default.
> I'm trying to do this with a simple shell script
> that just does
> newgrp thenewgroup
> umask 002
> If I (or users) do this interactively, it works
> fine. However, the umask doesn't stick around when
> executed from the shell script (reverts to 002). I
> suspect that the umask is only good for the life of
> the child process that is running the script (?).
> Any ideas how to make this work?

Use the .-command.
. shellscript

now the script is executed in the same shell from where it is executed.

--      


 
 
 

1. umask and shell scripts

I'd like to make it easy for users to log into a
different group and to make sure that when they do
that any files that are then created have group
write permission by default.

I'm trying to do this with a simple shell script
that just does

newgrp thenewgroup
umask 002

If I (or users) do this interactively, it works
fine.  However, the umask doesn't stick around when
executed from the shell script (reverts to 002).  I
suspect that the umask is only good for the life of
the child process that is running the script (?).

Any ideas how to make this work?

Thanks,
Mike

Sent via Deja.com http://www.deja.com/
Before you buy.

2. Battery Monitor Applet Problem (lombard)

3. handling SIGINT in shell scripts when executing another shell script.

4. lilo problem

5. Q: How can I have a shell script call another shell script...

6. Comprehensible Kernel Installation Guide v.5

7. Shell script invoking other shell scripts

8. Download Tiny X binary

9. Convert Bash shell script to Korn shell script

10. Shell Script Help (C-Shell Script)

11. How to pass a variable from a shell script to another shell script...

12. Shell script acting as interactive shell - $0 not script name??

13. shell script within shell script (general question)