This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Calling bash from system() on NT



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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]