Mike --

...and then Ford, Mike               [LSS] said...
% 
% On 15 April 2004 17:26, David T-G wrote:
% 
% > ...and then Ford, Mike               [LSS] said...
% > %
% > % I'm not sure, however, that this is a totally foolproof way
% > of doing it, as
% > % it would fail with any permission set (however unlikely)
% > where the owner
% > 
% > Would it?  Suppose I were setting it to 007; that would be 0007 with
% > the leading zero and should still be fine.
% 
% No.  The way you're building it, $r would be an integer before you add the leading 
zero -- 007 would thus be represented as just 7, and adding the leading zero the way 
I've shown above would give '07'.  Not good.

Indeed.  But of course I was trying to work with a string...


% 
...
% > Heck, I'll take any advice I can get :-)  I think, though, that the
% > problem is that I'm trying to use a string -- if I can get it built
% > correctly in the first place -- as an octal digit.
% 
% Possibly, but I think you're making the whole thing more complicated than it need 
be.  After a quick look at the manual, I'd suggest this:

As I clearly was.  But where did you see ^ in the manual?

Oh, I see it.  I had to look for it as ^ but I found it.  Oops; and it's
an XOR rather than a NOT.


% 
...
% Of course, I've been quite verbose there -- the short version is:
% 
%   $r = sprintf('%04o', 0777 ^ umask());

And the final version, I'm happy to say, is

  chmod ($target,0777^umask()) ;

and it works perfectly :-)


% 
% ... ;))
% 
% Cheers!
% 
% Mike


Thanks again & HAND

:-D
-- 
David T-G
[EMAIL PROTECTED]
http://justpickone.org/davidtg/      Shpx gur Pbzzhavpngvbaf Qrprapl Npg!

Attachment: pgp00000.pgp
Description: PGP signature

Reply via email to