Batch file and perl


 
Thread Tools Search this Thread
Special Forums Windows & DOS: Issues & Discussions Batch file and perl
# 1  
Old 11-28-2014
Batch file and perl

I have created a windows batch file to run a bash with perl commands in it:

Code:
 @echo off

C:
chdir C:\cygwin\bin\

bash --login -c "./windows_annovar.pl"
exit 0

In the pl file attached the menu opens and the user makes a selection and cygwin closes. There are error messages on the screen but it closes too quickly to see them. How can I pause the batch file and keep it from closing so I can see the messages and being troubleshooting? Thank you Smilie.

Last edited by cmccabe; 11-28-2014 at 02:23 PM..
# 2  
Old 11-28-2014
1. This is an MS-DOS question and is more appropriate in this forum.
2. I think it would be more convenient to directly run the perl program rather than wrapping it in a batch script. Not sure if you have a specific constraint for doing it this way.
3. If you do want to use it, look at the pause command.
# 3  
Old 11-28-2014
I will move the post and look into pause. Thank you Smilie.
# 4  
Old 11-28-2014
Batch file for bash with perl

I have created a windows batch file to run a bash with perl commands in it:


Code:
 @echo off

C:
chdir C:\cygwin\bin\

bash --login -c "./windows_annovar.pl"
exit 0

In the pl file attached the menu opens and the user makes a selection and cygwin closes. There are error messages on the screen but it closes too quickly to see them. How can I pause the batch file and keep it from closing so I can see the messages and being troubleshooting? Thank you Smilie.
# 5  
Old 11-28-2014
Merged the 2 threads...
# 6  
Old 11-28-2014
You're going about this all wrong. Smilie
The files you have attached
  • windows_annovar.sh
  • windows_annovar.pl
are the same file. You can't just rename files and expect them to run with different interpreters.

Code:
Line 117  windows_annovar.sh

    cd 'C:\Users\cmccabe\Desktop\annovar'
              $( perl table_annovar.pl ${id}_matched.avinput humandb/ -buildver ... blah blah blah)

This is calling perl table_annovar.pl to access a database (humandb) I think. Do you have all those perl files installed?? If so, perl needs to know where to find them. The full path to the folder that contains them should be in PATH as well as the full path to the perl modules.

PATH belongs in windows_annovar.sh...not this one. Actually, it belongs in the shell environment.
Get rid of this file.
Code:
windows_annovar.pl
#!/bin/bash

PATH="C:\\cygwin\\bin\perl.exe:${PATH}"
...
...


Last edited by ongoto; 11-28-2014 at 05:31 PM..
# 7  
Old 11-28-2014
Code:
 @echo off

C:
chdir C:\cygwin\bin\

bash --login -c "./windows_annovar.sh"
exit 0

Cygwin opens and closes quickly. The sh file is attached and in the file there are cd commands that contain the humandb. If I run it from the command line using
Code:
 bash ~/newbatch.sh

it runs fine. Since I am using windows I altered that file a bit and would like to have a user just double click on the bat file to run the program. Thank you Smilie.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Perl error in batch command but works one at a time

In the below perl executes if one file is processed perfect. However, when multiple files are processed in batch which is preferred I get the below error that I can not seem to fix it as the '' necessary for the command to execute, but seem to only work for one -arg option. Thank you :). ... (2 Replies)
Discussion started by: cmccabe
2 Replies

2. Shell Programming and Scripting

Renaming file in batch

Hi guys, I need a script to change the file names e.g.:- below are the mentioned files, i want t0 change the last character of the name 00000.cdr with e.g bep01.smsc.191214210500-00000.cdr to bep01.smsc.191214210500-92311.cdr next file be like bep01.smsc.191214210500-92312.cdr # ls -ltr... (9 Replies)
Discussion started by: mfaizan40
9 Replies

3. Shell Programming and Scripting

Perl: batch replace a portion of text in files

Hi all, What I would like to achieve is to batch change the code below in every pdf in a given directory (each pdf is uncompressed so that can be easily edited). An example of the javascript code: if (this.hostContainer) { try { this.hostContainer.postMessage(pp_216', 15259]);... (3 Replies)
Discussion started by: menteith
3 Replies

4. Shell Programming and Scripting

Executing a batch of files within a shell script with option to refire the individual files in batch

Hello everyone. I am new to shell scripting and i am required to create a shell script, the purpose of which i will explain below. I am on a solaris server btw. Before delving into the requirements, i will give youse an overview of what is currently in place and its purpose. ... (2 Replies)
Discussion started by: goddevil
2 Replies

5. UNIX for Advanced & Expert Users

batch file

Hi all I am using tru64 Unix and I want a ready batch file which makes me to change all user passwords at the same time ,instead of changing everyone separately. Please could anyone help me to do that. bye. (1 Reply)
Discussion started by: ahmedbashir
1 Replies

6. Shell Programming and Scripting

Batch file to remove double quotes from a file

Hi I have to create a windows batch file which will read an input file and remove "double quotes" from each line of the file. For eg.If input file name is abcd.csv and contents is : "asasd,123123,213213,asd" "esfrf,dsfsdf,234324,sdfsdf" Then the batch file should remove "" from the... (11 Replies)
Discussion started by: akashtcs
11 Replies

7. UNIX for Advanced & Expert Users

Batch file question

EDIT: Is this wrong thread? Hi I am on an Apple Mac and I am trying to run this batch file on my Mac and was wondering if anyone could tell me what a script that will make this run and work on my Mac. I was hoping that you could tell me the script in the shell format? So here's the batch... (4 Replies)
Discussion started by: Billy5555100
4 Replies

8. Programming

batch file

what is a command to call a batch file from a c++ program when called with the argument which is a text file, then how to print that text file on a printer. please help me with code if possible (3 Replies)
Discussion started by: ramneek
3 Replies

9. IP Networking

batch file

my requirment is i have to call a batch file from a c++ program that batch file is called with the argument as print.txt print.txt is a text file which should get printed on printer (any printer) when a batch file call is made 1) how to call a batch file in c++ 2) how to print the text... (1 Reply)
Discussion started by: ramneek
1 Replies
Login or Register to Ask a Question