[Novalug] Sample shell code...
Angelo Bertolli
angelo at freeshell.org
Fri Feb 23 14:19:06 EST 2007
Beartooth wrote:
> On Thu, 22 Feb 2007, Kevin Dwyer wrote:
>
>> On Thu, Feb 22, 2007 at 03:32:22PM -0800, Beartooth wrote:
>>> Urkkk! That's WhatsitDo5 -- and I'm back to
>>>
>>> [btth at localhost ~]$ ./WhatsitDo5
>>> bash: ./WhatsitDo5: Permission denied
>>> [btth at localhost ~]$
>>
>> If you wish to execute a script, you should permit the script to be
>> executed.
>
> 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.
>> Assuming a recent version of chmod:
>>
>> chmod u+x ./WhatsitDo5
>>
>> Translation: "Allow the owner of the file ./WhatsitDo5 to execute it"
>
> 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.
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?
Angelo
More information about the Novalug
mailing list