chmod go=u-w (was Re: Testing execute permission from csh)

Randal L. Schwartz @ Stonehenge merlyn at intelob.intel.com
Wed May 10 02:44:43 AEST 1989


In article <19486 at adm.BRL.MIL>, Kemp at DOCKMASTER writes:
| I have run across a bug in either csh or my understanding of it (almost
| certainly the latter).  I have a directory of files that were read from
| a tape with no world permissions:
| 
|  -rw-r-----  root   a.c
|  -rw-r-----  root   b.c
|  -rwxr-x---  root   a.out
| 
| I want to change all the files to have world read permission, and all
| the executables to have world execute.  I tried the following in csh as
| root:
| 
|  # foreach f (*)
|  ? if -x $f chmod o+x $f
|  ? end
| 
| and it selected EVERY file, not just those with execute permission.  (I
| actually used echo instead of chmod while testing).  If I do the same
| thing as a normal user, it works properly.

What I do frequently in my public bin is:

  chmod go=u-w *

which says "chmod these files for group and other to whatever it is
*for me* minus the 'write'".  (I put files that need to be publicly
writable somewhere else.)

So rw------- becomes rw-r--r-- and rwx------ becomes rwxr-xr-x,
automagically.

Ain't chmod fun?
-- 
***** PLEASE NOTE THE NEW ADDRESS *****
/=Randal L. Schwartz, Stonehenge Consulting Services (503)777-0095===\
{ on contract to BiiN, Hillsboro, Oregon, USA, until 14 May 1989     }
{ <merlyn at intelob.intel.com> ...!uunet!tektronix!biin!merlyn         }
{ or try <merlyn at agora.hf.intel.com> after 15 May 1989               }
\=Cute quote: "Welcome to Oregon... home of the California Raisins!"=/



More information about the Comp.unix.questions mailing list