This is the mail archive of the
cygwin
mailing list for the Cygwin project.
RE: Calling shell script from DOS
- From: "Herb Martin" <HerbM at learnquick dot com>
- To: <cygwin at cygwin dot com>
- Date: Fri, 27 Jan 2006 17:12:13 -0600
- Subject: RE: Calling shell script from DOS
> > I have installed Cygwin. I want to invoke a shell
> > script from the DOS/Windows command prompt (instead of
> > opening Cygwin Window first and calling it from
> > there). How can I do this?
>
> In addition to what others said, use "bash -c" instead of
> "bash" to honor
> the shebang ("#!") line. This would then work for tcsh, ksh, perl,
> python, [you name it] scripts, as well as symlinks. In fact,
> whenever you
> need to invoke a Cygwin program from the DOS prompt, and you
> don't know if
> it's a script, a symlink, or an actual .exe, you can't go
> wrong with "bash
> -c progname".
Excellent!!! I had noticed that things like
"ls", "dir", "d" didn't work (without that -c).
Now they do too!
Or course, they would just run anyway without the
bash but you are correct that one must otherwise
know "what type" of command it is.
> Adding --login (-l) is optional, but may be useful for
> scripts that make
> assumptions about your environment.
cool.
--
Herb Martin
>
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/