3

I got a perl script named test_perl.pl and try to exec it.
The first line of the scrpit is:

#!/usr/bin/perl

When I try to exec this script, I get an error.

$ type perl
perl is /usr/bin/perl

$ ll /usr/bin/perl test_perl.pl
-rwxr-xr-x 2 root        root        10352 2011-04-23 03:32 /usr/bin/perl*
-rwxr-xr-x 1 jim         jim         12121 2013-11-21 11:47 test_perl.pl*


$ test_perl.pl
test_perl.pl: line 1: #!/usr/bin/perl: No such file or directory

I don't no why this happens.

android_su
  • 1,637
  • 4
  • 21
  • 30

1 Answers1

4

You have a BOM (see http://en.wikipedia.org/wiki/Byte_order_mark) at the beginning of your file.

try

 xxd test_perl.pl

to see it. Getting rid of the BOM will fix your script: Lots of ways to do this: Using awk to remove the Byte-order mark

Community
  • 1
  • 1
Faiz
  • 16,025
  • 5
  • 48
  • 37