[CentOS] bash file direct execution

Tue Aug 2 13:11:26 UTC 2005
dan1 <dan1 at edenpics.com>

>> This is something interesting. If I run 'ldd', it works.
>> Now I copied this script to the / directory and run it again with /ldd. 
>> That
>> works too.
>> Now I have transformed that file into my little echo script:
>> #!/bin/sh
>> echo testing
>>
>> And that works too. So I have now two files (/ldd and /ldd2) which are
>> scripts and which contains exactly the same content and which behaves
>> differently, from the same directory. One is done from scratch and the 
>> other
>> is modified from another working script.
>>
>> Again each file's contents:
>> #! /bin/sh
>> echo testing
>>
>> The result is the following when executed:
>> [root at box /]# ./ldd
>> testing
>> [root at box /]# ./ldd2
>> [root at box /]#
>
>That is unusual. What are you using to edit these files? I seem to
>recall one of my users having some weirdness with shell scripts
>because the lines weren't terminated properly.
>
>Compare the output from...
>
>$ cat -A /ldd
>$ cat -A /ldd2


Hello again, Will.

Good idea. Here is what those files are containing exactly:
[root at box /]# cat -A /ldd
#! /bin/sh$
echo testing$
$
[root at box /]# cat -A /ldd2
#! /bin/sh$
echo testing$
$
[root at box /]#

They seem exactly the same..
BTW now, for any reason, I can create a new file in the / directory and run 
it properly (before it always didn't output anything). However by creating 
that in the /home directory it won't work, like before in /.

Regards,
Daniel