[comp.lang.perl] .signatures

merlyn@iwarp.intel.com (Randal Schwartz) (07/26/90)

In article <12443@mentor.cc.purdue.edu>, akf@mentor (Jay Hinkelman) writes:
| drwxr-xr-x   [other stuff]         ./
| 
| You can achieve this by typing "chmod gu+x ~/."  This allows anyone
| else, including the news program, to see the contents of your home
| directory. 

That should be

	chmod go=r-w $HOME

for all shells.  (This is a pretty handy combination to remember, by
the way.)  Your's might have turned on the x bits without the r bits,
and wouldn't have done anything for "other", which is probably what
the newsposter-program was considered as.

In Perl, of course, it'd be:

#!/usr/bin/perl
$h = $ENV{"HOME"}; $usermode = ((stat($h))[2]&0700) >> 6;
$nonwritemode = $usermode &~ 2;
chmod +(($usermode<<6)|($nonwritemode<<3)|($nonwritemode)), $h;

which goes to show ya that not everything is easier in Perl. :-)

Just another UNIX and Perl hacker,
-- 
/=Randal L. Schwartz, Stonehenge Consulting Services (503)777-0095 ==========\
| on contract to Intel's iWarp project, Beaverton, Oregon, USA, Sol III      |
| merlyn@iwarp.intel.com ...!any-MX-mailer-like-uunet!iwarp.intel.com!merlyn |
\=Cute Quote: "Welcome to Portland, Oregon, home of the California Raisins!"=/