0

I've made a simple bat file "run_perl.bat" that executes a Perl script "Oncomine_main.pl" in \data\test_scripts directory.

Here is the content of the bat file:

cd /data/test_scripts
perl Oncomine_main.pl

I run the script from the login directory

Here is what is returned to me:

[username@path-twood3 ~]$ ./run_perl.bat
: No such file or directory /data/test_scripts
": No such file or directorymine_main.pl

Please suggest how to fix this issue?

Thank you

Squashman
  • 13,649
  • 5
  • 27
  • 36
user3781528
  • 623
  • 6
  • 27
  • Most people would not call that a batch file since you are not using Microsoft Windows and cmd.exe. It's usually called a shell script, and you should have a ".sh" extension on it or no extension. – David Grayson Dec 20 '16 at 18:49

1 Answers1

1

Add #!/bin/sh as the first line of run_perl.bat.

megagrump
  • 128
  • 1
  • 8
  • i get `-bash: ./run_perl.bat: /bin/sh^M: bad interpreter: No such file or directory` after I've added #!/bin/sh. – user3781528 Dec 20 '16 at 19:15
  • run_perl.bat has DOS-style line endings (\r\n) instead of UNIX-style line endings (\n). Use `dos2unix run_perl.bat` to fix this. You may need to install `dos2unix` first. – megagrump Dec 20 '16 at 19:25
  • There is another bat file that someone else made that runs a script in a different directory. It executes the code correctly. I copied the exact synthax of that file, however, the bat file that I've made doesn't execute. – user3781528 Dec 20 '16 at 19:32
  • Okay. What do you expect us to do with that information? – megagrump Dec 20 '16 at 19:38
  • i will try to move the script to a different directory and see if it helps. I don't have anyone to ask so I thought I post this here. Thank you – user3781528 Dec 20 '16 at 19:43
  • The absolute minimum we need is the error message you're getting. Add an error message next time. – megagrump Dec 20 '16 at 19:48
  • ok, there was a space between `test_scripts` and `perl` that was causing a problem. – user3781528 Dec 20 '16 at 20:21
  • @user3781528 Stop using an editor that inserts DOS-style newlines. – twalberg Dec 20 '16 at 20:32