2

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?

2
  • Two thoughts: the terminal may be closing because it executed to completion just fine. Isn't there a command like pause that you can add at the end to wait for a key press? Second, the space in the filename may be causing problems; try adding single-quotes around the /cygdrive/k/Linux Scripts/Scripts/filter.sh filename. Commented May 4, 2012 at 0:18
  • @Sarnold. The script normally takes about 30 seconds to complete, and generates another file. In this case, it doesn't do anything. Commented May 4, 2012 at 8:07

1 Answer 1

3

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
Sign up to request clarification or add additional context in comments.

3 Comments

I tried that. Still no difference. Also tried the the -i option as in "bash --login -i ..."
echristopherson & Sarnold. Just realised that I had a mistake in my script. I had escaped the space in the path name with a backslash. When I remoed this, and used either single or double quotes as you both suggested, then it worked. Thanks!
Excellent! Please take this opportunity to learn the importance of copy and pasting what you actually tried, rather than re-typing content. Thanks!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.