LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   shabang lines don't work on my guru plug (https://www.linuxquestions.org/questions/linux-general-1/shabang-lines-dont-work-on-my-guru-plug-821712/)

msrk 07-23-2010 10:11 AM

shabang lines don't work on my guru plug
 
I have a GuruPlug computer running Debian Lenny.

I put a perl script on it with the following shabang line.

#!/root/bin/perl -w

When I run the program from the command line I get the following
message.


guru:~/bin$ ./ms_sync.pl
-bash: ./ms_sync.pl: /root/bin/perl: bad interpreter: Permission
denied

The permissions are:

guru:~/bin$ ls -al ms_sync.pl
-rwxr----- 1 ms users 11772 2010-06-17 10:48 ms_sync.pl

When I run 'which perl' the path I used is confirmed.
This perl script works on several other debian computer.

I can run perl and I can invoke the script as an arg to perl like
this:

guru:~/bin$ perl ms_sync.pl

Which works fine.

I think this has something to do with the way the root partition is
mounted. However, there seems to be a little guru black magic going
on to get the root partition mounted since it isn't in /etc/fstab. If
I enter mount on the command line I find the following line.

rootfs on / type rootfs (rw)

I cannot tell how it is mounted.

bash, perl, python, etc work but they all have this problem when
invoked via a shebang line.

How can I get shebang lines to work?

Thank you,
Marc

GrapefruiTgirl 07-23-2010 10:15 AM

Any chance the following works as a shebang?

Code:

#!/bin/env/perl -w

or maybe:

#!/usr/bin/env perl -w

Note: I have never heard of a "GuruPlug" so forgive me if this doesn't apply; and, I don't typically do this, so my syntax may be slightly adrift, but the point I'm trying to indicate is to use the `env` capability to locate the proper interpreter.. :)

sem007 07-23-2010 10:15 AM

Hi msrk wel-come to LQ,

try as shebang
#!/usr/bin/perl

msrk 07-25-2010 05:01 AM

Thank you all for the suggestions. After trying:

#!/bin/env/perl -w

It occurred to me that the problem may be the mount permissions of the disk holding the perl script rather than the disk holding perl itself. I was right. I had the 'noexec' option turned on. I remounted the disk without that directive and all is well.

GrapefruiTgirl 07-25-2010 08:03 AM

Cool :) glad you found the problem. If you haven't yet, you could mark this [solved] using Thread Tools, from the menu near the top.


All times are GMT -5. The time now is 02:28 AM.