Piotr Bielski Piotr Bielski - 2 years ago 307
Perl Question

Running Perl executables in git-bash

I tried to run script in git bash command line and I saw:

"use: command not found"

When I changed sh file from
to '
perl ./clean_translations.pl'

After that script works.

I have win 8.1. Path is as in other PC (win 7).
What should I change to works without 'perl'?

Edit: echo $PATH:

y/perl/lib:/c/Program Files (x86)/ActiveState Komodo IDE 8:/c/instantclient_12_1
:/c/Program Files/Java/jdk1.8.0_91/bin:/c/Program Files/Java/jre1.8.0_91/bin:/c/
Program Files (x86)/Intel/iCLS Client:/c/Program Files/Intel/iCLS Client:/c/Wind
sPowerShell/v1.0:/c/Program Files/Intel/Intel(R) Management Engine Components/DA
L:/c/Program Files (x86)/Intel/Intel(R) Management Engine Components/DAL:/c/Prog
ram Files/Intel/Intel(R) Management Engine Components/IPT:/c/Program Files (x86)
/Intel/Intel(R) Management Engine Components/IPT:/c/Program Files (x86)/ATI Tech
nologies/ATI.ACE/Core-Static:/c/Program Files (x86)/GitExtensions:/bin:/mingw64/

Answer Source

You need to use a shebang.

Add this as the first line of the script:

#!/usr/bin/env perl

This conveys that the script should be run using Perl interpreter.

If you are running the script on windows shebang is not parsed. The file extension(.pl) is used to decide the interpreter. In a bash shell shebang is necessary.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download