[vox-tech] Binary problems

Jonathan Stickel vox-tech@lists.lugod.org
Thu, 26 Feb 2004 14:34:20 -0800


Doctorcam wrote:
> * Jeff Newmiller (jdnewmil@dcn.davis.ca.us) wrote:
> <snip>
> 
>>The behavior of the first token on a bash commandline is different than
>>its behavior when provided as the argument to an instance of bash... bash
>>interprets the _argument_ as a normal path to a script file... which
>>amounts to allowing invocation of shell scripts in the current directory.  
>>When provided as the first token on a commandline, bash is more cautious
>>if no slashes are present.
>>
> 
> 
> So, just so I understand the reasoning, instead of my blind rote
> fumbling, do I understand correctly that the function of the ./ is
> merely to identify the directory?  Is there more to this than that?  I
> had the assumption that its function was to identify the following
> item as an executable.
> 
> Cheers
> 
> Cam
> 

The ./ just specifies the directory.  Whether it is executable depends 
on the file itself and its permissions (someone can add to this).

Here is a good exercise for shell beginners, like me :)

$ cat hello
#!/bin/sh

echo "hello world"

$ ll hello
-rw-r--r--    1 jjstickel users          32 Feb 26 13:55 hello
$ ./hello
bash: ./hello: Permission denied
$ chmod +x hello
$ ./hello
hello world
$