[CentOS] bash file direct execution

Tue Aug 2 13:27:18 UTC 2005
Will McDonald <wmcdonald at gmail.com>

On 02/08/05, dan1 <dan1 at edenpics.com> wrote:
> >> 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 /]#

OK, those both look identical, but ldd2 doesn't run? 

> 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 /.

This is weird, could it be SELinux related? Have you got SELinux
enabled? And if so, can it be switched off to check if it's the cause
of the problem?

Will.