Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT sources DOT redhat DOT com Delivered-To: mailing list cygwin AT sources DOT redhat DOT com Message-Id: <200107101536.JAA22911@gldnbuffs.cr.usgs.gov> X-Authentication-Warning: gldnbuffs.cr.usgs.gov: lucky AT localhost didn't use HELO protocol To: cygwin AT cygwin DOT com Subject: Calling bash from system() on NT Date: Tue, 10 Jul 2001 09:36:25 -0600 From: Lucky Vidmar I am porting an application from Unix (Solaris) to NT 4.0. Part of the application calls a script to do some convoluted creation and manipulation of PostScript and GIF files. Since I could not figure out how to accomplish the task with the native NT batch scripting, I decided to give Cygwin bash a try. I installed bash-2.05-6, along with the latest versions of every other available package. I wrote a bash script to do what I needed and it worked great when executed from within bash.exe. Then, I invoked that script from the NT cmd.exe window using: \cygwin\bin\bash -c "/cdrive/bin/myscript arg1 arg2..." This also worked correctly. But, when I tried to execute the same line as above from a system() call within a C program compiled under NT, the call returned with error number 127. I am able to execute the following statement: system ("\\cygwin\\bin\\bash --help > \\out") But not this:: system ("\\cygwin\\bin\\bash -c ls > \\out") This leads me to belive that the problem is with executing bash with the -c option as I am unable to execute any commands this way from the system() call, although I can do it by executing the exact same line from the CMD window directly. I searched the list archives to see if this problem had been addressed before but could not find anything directly on point. Any help will be greatly appreciated. Lucky Vidmar Earthquake Hazards Team US Geological Survey Golden, Colorado, USA -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/