• Home
  • Help
  • Search
  • Login
  • Register
Pages: [1]
Author Topic: shabang lines don't work on my guru plug  (Read 1092 times)
msrk
Newbie
*

Karma: 0
Posts: 9


View Profile
« on: July 22, 2010, 10:51:14 AM »

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

  #!/root/bin/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/bin/perl: bad interpreter: Permission denied

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

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
Logged

ppmt
Full Member
***

Karma: 1
Posts: 129


View Profile
« Reply #1 on: July 22, 2010, 11:21:27 AM »

are you sure that perl is in /root/bin/bin/

the double bin seems strange

what does 'which perl' gives?
Logged

velo_love
Newbie
*

Karma: 0
Posts: 15


View Profile
« Reply #2 on: July 22, 2010, 01:03:09 PM »

On my Guruplug Server +:

Code:
~$ which perl
/usr/bin/perl

Moreover, if your program contains
Code:
#!/usr/bin/perl
and is made executable
Code:
chmod +x ms_sync.pl

you can run it directly without calling the perl interpreter:
Code:
./ms_sync.pl
Logged

msrk
Newbie
*

Karma: 0
Posts: 9


View Profile
« Reply #3 on: July 22, 2010, 02:15:37 PM »


Thank you for your replies.
The bin/bin is a typo only in the message posted to this group.   In the script it is /usr/bin/perl.

Yes, I have made hundreds of scripts with the shabang line and +x permission.  That is why this is so strange that it doesn't work here.  None of the shabang lines in any of my scripts  work.  I think this is some problem with the way the rootfs is mounted.

I will appreciate any help.  Also, please let me know if you are expiencing the same thing on your GuruPlug.




Logged

puddles
Newbie
*

Karma: 0
Posts: 1


View Profile
« Reply #4 on: August 01, 2010, 12:02:04 PM »

You probably edited this file under windows or something and the shebang line actually ends with <cr><lf> instead of the unix <lf> only.  Do "od" on it, like so:

od -cv /path/to/the/perl/script

and verify the line endings.  Use "dos2unix" to convert the file back to unix line ending convention.
Logged

Pages: [1]
Print
Jump to: