Tell me more ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I have a batch script that looks like this

@ echo off c:/cygwin/bin/bash -li each_sec_extract.bash c:/iperfprocess/sprint/file1.txt > c:/iperfprocess/sprintbashed/file1.txt each_sec_extract.bash c:/iperfprocess/sprint/file2.txt > c:/iperfprocess/sprintbashed/file2.txt

When i run this as is, the CYGWIN bash terminal pops up and I can observe the script producing the output I want on the screen, however, when I go to the directory where the file should be located (c:/iperfprocess/sprintbashed/), I am greeted by an empty text file. When i enter instructions from the CMD line manually, I receive the same result. However, when I run the instruction directly from CYGWIN, it works flawlessly. The part that frustrates me the most, this script used to work fine, then I started getting SED: permission denied errors which forced me to run bash.exe in administrative mode.

Any ideas about what might be happening or what a solution may be? Thank you in advance for any and all help provided.

share|improve this question
Your script has no line breaks. – foxidrive 19 hours ago
there is a line break between @ echo off and c:/cygwin/bin/bash -li each_sec_extract.bash c:/iperfprocess/sprint/file1.txt > c:/iperfprocess/sprintbashed/file1.txt each_sec_extract.bash c:/iperfprocess/sprint/file2.txt > c:/iperfprocess/sprintbashed/file2.txt – Donald Willis 2 hours ago

1 Answer

Is this any different?

@echo off
c:/cygwin/bin/bash -li each_sec_extract.bash c:/iperfprocess/sprint/file1.txt > c:/iperfprocess/sprintbashed/file1.txt 
c:/cygwin/bin/bash -li each_sec_extract.bash c:/iperfprocess/sprint/file2.txt > c:/iperfprocess/sprintbashed/file2.txt
share|improve this answer
Basically it is the same, the reason I dont write it like that is because of a "SED: permission denied error" that requires me to run bash.exe in administrative mode to bypass the error; I'm running between 4,000 to 6,000 files through this script so requesting admin privileges that many times would be unacceptable. In addition, writing the bash script as you mentioned still yields empty output files – Donald Willis 2 hours ago

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.