Testing execute permission from csh

Kemp at DOCKMASTER.NCSC.MIL Kemp at DOCKMASTER.NCSC.MIL
Sat May 6 11:33:57 AEST 1989


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.

  Obviously ls knows what the permissions are, and so does exec; if I
try to run a.c, I get "Permission denied".  What is wrong with my use of
csh?  (I am using SunOS 4.0.1, if it matters.)

  I finally had to solve the problem by using ls, grep, and colrm to
generate the list of files to modify.


  Dave Kemp <Kemp at dockmaster.ncsc.mil>



More information about the Comp.unix.questions mailing list