[vox-tech] perl question -- running a bash built-in
vox-tech@lists.lugod.org
vox-tech@lists.lugod.org
Thu, 5 Dec 2002 15:37:23 -0500
On Thu, Dec 05, 2002 at 12:26:57PM -0800, Peter Jay Salzman wrote:
> how do i get at the value of umask from within a perl script? since
> umask is bult into bash, i can't do something like:
>
> my $umask = `umask`;
not an environment variable.
umask is a process trait, which is inherited by fork. there is a system
call call "mode_t umask(mode_t mask)", for changing it, see some more in
man 2 umask.
to muck with umask in perl there is a function, umask.
umask EXPR
umask Sets the umask for the process to EXPR and returns
the previous value. If EXPR is omitted, merely
returns the current umask.
for more see man perlfunc, search for ' umask '...
Later,
Mike
ps:
had umask been an env variable it would have been adjusted by mucking with
the ENV has...
$ENV{'umask'} = "0644';
see more in man perlvar