Computing.Net > Forums > Programming > Shell script under windows

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Shell script under windows

Reply to Message Icon

Name: Matthijs_1971
Date: May 6, 2009 at 03:24:11 Pacific
OS: Windows XP
Subcategory: C/C++
Comment:

Hi,

I need to run a very complicated Bourne shell script under windows from a very complicated C++ Windows program. Of course, there is cygwin to emulate a linux environment, and there is system to place a call from C++ to start up cygwin.

But... how do I convince cygwin to run my script? I have no clue...

I need to pass the script's name to the bash.exe of Cygwin or so.

main()
{
>>system("c://cygwin//bin//bash.exe < script.sh");
}

Who can help?

Thank you, kind regards, Matthijs.



Sponsored Link
Ads by Google

Response Number 1
Name: nails
Date: May 6, 2009 at 07:17:58 Pacific
Reply:

I do not use cygwin, but try treating your script as an argument to the shell:

system("c://cygwin//bin//bash.exe script.sh");

(I removed the < sign)

You may have to experiment. For example, you may have to use a full path to the script.sh file. Depending on how involved script.sh is, you may still have trouble executing it.

Also, script.sh can not easily return data to the calling "C" program.


0
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Shell script under windows

transfering shell script to windows www.computing.net/answers/programming/transfering-shell-script-to-windows/3681.html

running shell script on XP www.computing.net/answers/programming/running-shell-script-on-xp/14232.html

Shell script & Word Macro www.computing.net/answers/programming/shell-script-amp-word-macro/5931.html