Testing execute permission from csh
Michael Morrell
morrell at hpsal2.HP.COM
Tue May 9 08:59:39 AEST 1989
/ hpsal2:comp.unix.questions / Kemp at DOCKMASTER.NCSC.MIL / 6:33 pm May 5, 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.
----------
I think since the superuser can execute any file even if it has mode 000,
csh tries to do you a favor and always returns true for "-x" if you are root
(same goes for "-r" and "-w"). I don't know if I like this "feature".
Michael
More information about the Comp.unix.questions
mailing list