Paul
Paul

Reputation: 463

Cygwin: Running bash script directly inside dos batch file doesn't work

I've searched over the web and still can't figure it out. I apologise if this sounds like a lazy whinging cry for help -- I really am at wit's end with this one.

I have a bash script located at: /cygdrive/k/Linux Scripts/Scripts/filter.sh

I've copied the Cygwin.bat to filter.bat, and changed it as follows:

@echo off
L:
chdir L:\Cygwin\bin
bash --login "/cygdrive/k/Linux Scripts/Scripts/filter.sh amc.txt bmo.txt"

When I run filter.bat by double-clicking on it in Windows Explorer, the console flashes open momentarily and then closes. The script is OK, because it runs from the command line in the Cygwin console.

Is there a way to debug this problem?

Upvotes: 2

Views: 6146

Answers (1)

echristopherson
echristopherson

Reputation: 7074

Try running the batch file from an already-existing Command Prompt window so you can see any error messages bash might send. I'm guessing it has a problem with "/cygdrive/k/Linux Scripts/Scripts/filter.sh amc.txt bmo.txt" -- as far as it's concerned, that's one argument rather than three. Therefore I would change it to

bash --login "/cygdrive/k/Linux Scripts/Scripts/filter.sh" amc.txt bmo.txt

Upvotes: 3

Related Questions