A ./ problem

If none of the more specific forums is the right place to ask

A ./ problem

Postby tukkek » 2005-12-17 17:06

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.
tukkek
 
Posts: 16
Joined: 2005-12-17 15:38

Postby miahfost » 2005-12-18 00:19

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?
miahfost
 
Posts: 4
Joined: 2005-12-18 00:13
Location: Lerum, Sweden

Postby tukkek » 2005-12-18 12:58

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?.
tukkek
 
Posts: 16
Joined: 2005-12-17 15:38

Postby Jeroen » 2005-12-18 13:25

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.
Jeroen
Debian Developer, Site Admin
Debian Developer, Site Admin
 
Posts: 571
Joined: 2004-04-06 18:19
Location: Utrecht, NL

Postby tukkek » 2005-12-18 13:57

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
tukkek
 
Posts: 16
Joined: 2005-12-17 15:38

Postby dawgie » 2005-12-19 21:43

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


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

Postby tukkek » 2005-12-22 00:17

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

Postby tukkek » 2005-12-22 00:18

BTW,
I can't run any shell script from Konqueror either, as it returns me the same error.
tukkek
 
Posts: 16
Joined: 2005-12-17 15:38


Return to General Questions

Who is online

Users browsing this forum: No registered users and 7 guests

fashionable