Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

A ./ problem

If none of the specific sub-forums seem right for your thread, ask here.
Post Reply
Message
Author
tukkek
Posts: 16
Joined: 2005-12-17 15:38

A ./ problem

#1 Post by tukkek »

Hi there,
I've just migrated to Debian from the Kurumin distribution, where when I wanted to run a shell script, I ran
./script.sh
from the konsole.

Now, when I try to do this, i receive:
bash: ./script.sh: /bin/sh: bad interpreter: Permission Denied

My /bin/sh is a link to bash ( /bin/sh -> bash ), and I've also tried to change it to /bin/bash ( /bin/sh -> /bin/bash ), but the result is the same, as it's too when I use the
./script.sh
command as root.

I can use
sh script.sh
normally, but if somebody could tell me what's happening, I'd be very happy.

miahfost
Posts: 4
Joined: 2005-12-18 00:13
Location: Lerum, Sweden

#2 Post by miahfost »

Can you post the first line of your shell script?

Does your shell script have the complete shebang line, like this:

#!/bin/sh

Does the shell script have the correct permissions to be executable?

tukkek
Posts: 16
Joined: 2005-12-17 15:38

#3 Post by tukkek »

It's not a single script that doesn't work with ./ - it's every single one I try to run.
And yes, all of them have the proper permissions and the #!/bin/sh as first line.

By the way, is this called a "shebang line"? Never heard of it. Why is that?.

Jeroen
Debian Developer, Site Admin
Debian Developer, Site Admin
Posts: 483
Joined: 2004-04-06 18:19
Location: Utrecht, NL
Contact:

#4 Post by Jeroen »

What does ls -l /bin/sh /bin/bash ./script.sh give? And cat /proc/mounts ?

And shebang is shorter way to say 'hashbang', which is 'haSH' 'bang', or the names of the characters '#' and '!'. See http://en.wikipedia.org/wiki/Shebang for more information.

tukkek
Posts: 16
Joined: 2005-12-17 15:38

#5 Post by tukkek »

Gotta love Wikipedia! Thanks for the link - I feel better as a geek now.

Maybe it's useful I mention again that even as the root user I still get the same error. For the outputs:

$ls -l /bin/sh /bin/bash ./script.sh:
-rwxrwxr-x 1 root alex 649556 2005-10-13 14:58 /bin/bash
lrwxrwxrwx 1 root root 4 2005-12-14 16:25 /bin/sh -> bash
-rwxr-xr-x 1 alex alex 645 2005-12-15 14:10 ./clean.sh

$cat /proc/mounts:
rootfs / rootfs rw 0 0
/dev2/root2 / reiserfs rw 0 0
proc /proc proc rw,nodiratime 0 0
sysfs /sys sysfs rw 0 0
devpts /dev/pts devpts rw 0 0
tmpfs /dev/shm tmpfs rw 0 0
/dev/sda6 /home xfs rw 0 0
/dev/sda2 /mnt/sda2 xfs rw,nosuid,nodev,noexec 0 0
usbfs /proc/bus/usb usbfs rw 0 0

User avatar
dawgie
Posts: 430
Joined: 2004-06-16 21:30
Location: New Hampshire USA

#6 Post by dawgie »

tukkek wrote: -rwxrwxr-x 1 root alex 649556 2005-10-13 14:58 /bin/bash
Who is alex?
Why does he own bash?

# chown root:root /bin/bash
# chmod 755 /bin/bash


:)

tukkek
Posts: 16
Joined: 2005-12-17 15:38

#7 Post by tukkek »

I'm alex, dawgie
It was just a test to see if I got better results owning the bash or it's link /bin/sh, but doesn't seem to be the case.

tukkek
Posts: 16
Joined: 2005-12-17 15:38

#8 Post by tukkek »

BTW,
I can't run any shell script from Konqueror either, as it returns me the same error.

Post Reply