Calling a program without bash login

Randall R Schulz rrschulz@cris.com
Mon Jan 13 03:30:00 GMT 2003


Travis,

You're not giving us much to go on, but here's a better attempt:

C:\cygwin\bin\bash -c "exec /usr/local/bin/ruby /home/travis/myprog.rb"

However, I don't see why you're involving BASH or any shell at all. If the 
Ruby interpreter is invoked from a context in which there is no 
character-stream standard input and output, a console window will be 
created automatically.

You'll only need the BASH if you want the initial point of entry to be a 
shell script. Since as shown you want to invoke the Ruby interpreter 
directly, the shell offers little. One reason you might want to do this is 
if you required environment setup performed within the shell initialization 
processing.

You can create a Windows shortcut or a batch file that will launch Ruby 
with the appropriate script / program name argument. If you use the 
shortcut, you can also establish the window size and position, the font 
used, the colors displayed, etc. I'm not fond of batch scripts, so I don't 
know if similar flexibilty is available that way.

The shortcut approach I favor will allow an arbitrary command invocation, 
so you can use it with or without an intervening shell invocation.

The only thing you'll need to do, at a minimum, is make sure that the 
Cygwin bin directory is in the PATH so that Windows can find and load the 
Cygwin1.dll, the common prerequisite of all Cygwin programs.

Randall Schulz


At 11:40 2003-01-10, Travis Whitton wrote:
>Hello,
>
>I have written a rather extensive program using the cygwin build of
>ruby. Ruby is installed in cygwin inside of /usr/local/bin. I'm trying
>to find a way to create a script to invoke my program without it's users
>having to go into a cygwin bash shell and run it. Ideally, it would be
>something as simple as:
>
>C:\cygwin\bin\bash /usr/local/bin/ruby /home/travis/myprog.rb
>
>but obviously that doesn't work. So, can anybody clue me in as to how to
>accomplish this seemingly simple task? I sure would appreciate it!
>
>Thanks in advance,
>Travis Whitton <whitton@atlantic.net>



More information about the Cygwin mailing list