|Subject:||Scripts (such as Cpan and Perldoc) don't work from MSys Bash|
|Date:||Sun, 20 Jan 2013 21:05:12 +0000|
|From:||Matt Hickford <firstname.lastname@example.org>|
Hi. I use MSys' Bash as my shell on Windows, as do many others (it's shipped with Git for Windows). It happens that none of the commands installed with Strawberry Perl such as cpan or perldoc work right:
sh.exe": /c/strawberry/perl/bin/cpan: /usr/local/bin/perl: bad interpreter: No such file or directory
On investigation this is because the file C:\strawberry\perl\bin\cpan begins with the shebang #!/usr/local/bin/perl . This isn't where Strawberry Perl is installed on my computer (it's installed at C:\strawberry\perl\bin\perl.exe ).
This *is* a bug in Strawberry Perl, not in MSys. The Windows distributions of other programming languages - Python, Ruby and Nodejs - all solve the problem, albeit in different ways.
Ruby carefully writes correct shebang in each script it installs, eg. #!C:/Ruby193/bin/ruby.exe
Python builds an .exe for each script installed .
Nodejs installs the actual script somewhere else, and in the bin directory installs a shim beginning with the shebang #!/bin/sh . (This works because MSys resolves / to its root directory, so the path to sh is correct)