Find the answer to your Linux question:
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 14
Hi, So I am pretty sure it's something I did when I reformatted my new drive to ext3, but it seems that I can no longer run script files by ...
  1. #1
    Just Joined!
    Join Date
    Sep 2008
    Posts
    6

    shell scripts stopped running when called xxx.sh

    Hi,
    So I am pretty sure it's something I did when I reformatted my new drive to ext3, but it seems that I can no longer run script files by just calling them:

    Code:
    # ./test.sh
    bash: ./test.sh: /bin/sh: bad interpreter: Permission denied
    the shbang is correct, and I've tried it as both root and a normal user.

    It does run if I do:

    Code:
    # ./sh test.sh
    /etc/fstab for that drive says:

    Code:
    /dev/disk/by-id/scsi-SATA_ST9120821A_5PL0Q6K0-part6     /data   ext3    user,acl,user_xattr
    I know it's gotta be something simple, but I'm at a loss

    Any help is appreciated

  2. #2
    Trusted Penguin Cabhan's Avatar
    Join Date
    Jan 2005
    Location
    Seattle, WA, USA
    Posts
    3,230
    I don't know much about extended attributes or ACLs, but I notice that you have both enabled for this filesystem, and that does worry me a bit.

    Can you run the command "getfacl /path/to/file" for the affected shell script? This will display the ACL for the file, and we can see if that is preventing you from executing it.
    DISTRO=Arch
    Registered Linux User #388732

  3. #3
    Linux Guru
    Join Date
    Nov 2007
    Posts
    1,695
    I would guess the shell scripts are not executable.

    Code:
    chmod 755 /path/file.sh

  4. #4
    Just Joined!
    Join Date
    Sep 2008
    Posts
    6
    The script is executable (actually, I had made it world r/w/x just to see if it was something along those lines)


    Code:
     # getfacl ./test.sh
    # file: test.sh
    # owner: nitehawk
    # group: users
    user::rwx
    group::rwx
    other::rwx

  5. #5
    Linux Guru
    Join Date
    Nov 2007
    Location
    Córdoba (Spain)
    Posts
    1,513
    Quote Originally Posted by nitehawk View Post
    Hi,
    So I am pretty sure it's something I did when I reformatted my new drive to ext3, but it seems that I can no longer run script files by just calling them:

    Code:
    # ./test.sh
    bash: ./test.sh: /bin/sh: bad interpreter: Permission denied
    the shbang is correct, and I've tried it as both root and a normal user.

    It does run if I do:

    Code:
    # ./sh test.sh
    I noticed that you are running sh on the current directory, that and your first error make it seem like if /bin/sh doesn't exist, or it can't be read for whatever reason. So, what does "ls -l /bin/sh" tell you?

  6. #6
    Just Joined!
    Join Date
    Sep 2008
    Posts
    6
    Code:
    # ls -l /bin/sh
    lrwxrwxrwx 1 root root 4 Jul 30 01:07 /bin/sh -> bash
    tnx

  7. #7
    Linux Guru
    Join Date
    Nov 2007
    Location
    Córdoba (Spain)
    Posts
    1,513
    Quote Originally Posted by nitehawk View Post
    Code:
    # ls -l /bin/sh
    lrwxrwxrwx 1 root root 4 Jul 30 01:07 /bin/sh -> bash
    tnx
    It's a symlink, that's right. How about ls -l /bin/bash?

  8. #8
    Just Joined!
    Join Date
    Sep 2008
    Posts
    6
    Code:
    # ls -l /bin/bash
    -rwxr-xr-x 1 root root 663704 2008-06-06 16:04 /bin/bash

  9. #9
    Linux Guru
    Join Date
    Nov 2007
    Location
    Córdoba (Spain)
    Posts
    1,513
    That seems right as well. Strange.

    Well, a couple of things you can try:

    1. Boot from a livecd and fsck your disk, to see if there's disk corruption.
    2. Double check your script and the shabang, maybe there's some odd character on that line that the editor is not displaying, so check in many editors.

  10. #10
    Just Joined!
    Join Date
    Sep 2008
    Posts
    6
    Quote Originally Posted by i92guboj View Post
    That seems right as well. Strange.

    Well, a couple of things you can try:

    1. Boot from a livecd and fsck your disk, to see if there's disk corruption.
    2. Double check your script and the shabang, maybe there's some odd character on that line that the editor is not displaying, so check in many editors.
    Thanks,
    I'll try running fsck on the disk in a bit.
    All of my scripts are acting the same way - I tried ones I wrote, and others and they all give me the bad interpreter.

Page 1 of 2 1 2 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...