[CentOS] bash file direct execution

Sun Jul 31 14:28:11 UTC 2005
Johnny Hughes <mailing-lists at hughesjr.com>

On Sun, 2005-07-31 at 15:56 +0200, dan1 wrote:
> Hi all.
> 
> I have a little strange problem.
> I created a file called 'test.sh' in the root directory containing:
> #!/bin/sh
> echo test
> 
> When I execute it with '/test.sh' there is no output.
> When I source it by executing it with '. /test.sh' the output comes ok.
> When I move it to '/root' and execute it with '/root/test.sh' then it works 
> perfectly.
> When I move it to '/home' and execute it with '/home/test.sh' there is no 
> output.
> 
> Could someone tell me what I shoud do to make the script run without 
> sourcing it with '.' ?
> This problem happens only on one CentOS 4 box I have, on the others it works 
> perfectly. What am I doing wrong ?
> The permissions are 755 on the file itself, and I execute them logged as 
> root.
> 
> Thanks,
> Daniel
> 

Dan,

I can't duplicate your issue ... test.sh prints test on my xterm console
every time.

It works whether I use echo test or echo "test" ... and works with
#!/bin/sh or #!/bin/bash ... on my CentOS-4 i386 machine.

It also worked for both root and a non-root user.

--
Johnny Hughes
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://lists.centos.org/pipermail/centos/attachments/20050731/0010a0b8/attachment-0005.sig>