[Novalug] Sample shell code...
karhunhammas at Lserv.com
Fri Feb 23 14:28:41 EST 2007
On Fri, 23 Feb 2007, Angelo Bertolli wrote:
> Beartooth wrote:
>> This is true of scripts in general, then? And, by implication,
>> any linux knows a script when it sees one, and that's why
>> ownership alone does not enable it? The things youss guyss's
>> fingers've known so long you need not think of them any more
>> must be legion ...
> Hmm? I don't follow. Why would ownership of a file imply that
> the shell you're using should try to execute commands in that
> file? I agree, if the file starts with something like
> #!/bin/bash, your shell could just assume it's executable, but
> that's not a good policy. It's better to be explicit about the
> things you want to make executable.
Let me try it another way. I don't see offhand
when/how/why I would want to have an executable file in my home
directory, and deny *myself* permission to execute it. Yet those
of you old gray elephants with survival scars take it for granted
that you not only do want that, you want it to be the default.
>> I tried it first with plain "chmod +x" and it ran. What does
>> the "u" do?
> One (my preferred) way to use chmod is like chmod
> [u,g,o,a][+,-][r,w,x,X,s] filename. It lets you change for
> user, group, other, or all, turning on or off the read, write,
> execute bits.
All right, I saw that array at the top of the chmod man
page. I *think* you're saying something I had no hint of : that
the way the array is *used* is that "chmod u+x" is specific and
explicit -- and that "chmod +x" defaults to it. Right?
> Also, I think since we're talking about this, it's really
> really important to mention that people never ever use chmod
> -r, instead using chmod -R for recursive changes. I have
> absolutely NO IDEA why chmod -r includes the .. directory! No
> other command I know of does this, and it seem so incredibly
> stupid and dangerous. Also, what is the point? Why on earth
> would recursion simply just do every file on the system?
There again, the unspoken but obviously strong and
ubiquitous reluctance to have executable files, even in your own
directory, with permission for you yourself to execute them. I'm
convinced; but I'm still puzzled.
Beartooth Neo-Redneck, Linux Evangelist
More information about the Novalug