This is the mail archive of the cygwin 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]
Other format: [Raw text]

Re: Calling shell script from DOS

On Thu, 26 Jan 2006, Pinaki Mukherjee wrote:

> 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".

Adding --login (-l) is optional, but may be useful for scripts that make
assumptions about your environment.
      |\      _,,,---,,_ |
ZZZzz /,`.-'`'    -.  ;-;;,_		Igor Peshansky, Ph.D. (name changed!)
     |,4-  ) )-,_. ,\ (  `'-'		old name: Igor Pechtchanski
    '---''(_/--'  `-'\_) fL	a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

"Las! je suis sot... -Mais non, tu ne l'es pas, puisque tu t'en rends compte."
"But no -- you are no fool; you call yourself a fool, there's proof enough in
that!" -- Rostand, "Cyrano de Bergerac"

Unsubscribe info:
Problem reports:

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