Friday, 15 April 2011

Start Perl script via "Windows Command" through Cygwin -


I have the following problem:

I started a Perl script from Window Scheduler via cygwin

The steps I take: call process.bat in process.bat I call bash with parameter for perl script

Symptom: If I " Pearl script path ", call it directly from Sigwin, it works like a magic if I get the script from Windows CMD to bash L'therefore it will not work.

Command: C: \ Signin \ bin \ bash.exe --login / cygdrive / c / scripts / testcript.pl It prints the following:

  line 3 : Use: Command not found Line 4: Use: Command not found File can not be found Test   

Script:

  #! Use / usr / bin / perl strict; Use warnings; Print "test";   

Maybe I'm just making a small mistake and can not see it. It appears that it is interpreted with Windows CMD instead of Perl.

The bash is considered as a script, not a Perl script. There is no reason to use Bash in this case - just open Pearl directly:

  C: \ cygwin \ bin \ perl.exe /cygdrive/c/scripts/testscript.pl < / Code>  

If you want to actually make your way - calling a CMD script that calls a Bash script that calls the Perl script - then you have to type a bit of script to open your Perl script:

  #! / Bin / sh /cygdrive/c/scripts/testscript.pl   

and pass that bishcript parameter when you call Bash.

No comments:

Post a Comment