Marley
Marley

Reputation: 185

Really strange behavior with Linux Shell Scripts

i am really wondering why Linux (Debian Squeeze) is acting kind of crazy. I've been trying to execute a simple test.sh script in my webapps directory:

/var/www/tomcat7/webapps/ROOT/WEB-INF/bin/

How to execute a script? Well, that would be done by entering:

EDIT: ITS NOT ABOUT WRONG (FORGOTTEN) PERMISSIONS:

chmod +x test.sh 

./test.sh

which now gives me the following:

-bash: ./test.sh: No permission

test.sh is looking like this:

#!/bin/bash

echo "Hello!"

What the hek? Copying/Moving test.sh to my home directory and execute it again, which gives me:

Hello!

which is actually the output from my test.sh file. So, it doesnt work in my webapp directory but it works in home?

My researches:

Trying to execute the script with sudo rights:

When executing the script with sudo the script simply does nothing. No messages at all.

Trying to execute it via

. test.sh

It works! But why?

Upvotes: 0

Views: 128

Answers (1)

Ignacio Vazquez-Abrams
Ignacio Vazquez-Abrams

Reputation: 798456

The volume the file is on is mounted noexec. You will need to remount it exec, but consider/research why it was mounted noexec in the first place.

Upvotes: 4

Related Questions