delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2006/01/27/13:20:48

X-Spam-Check-By: sourceware.org
Date: Fri, 27 Jan 2006 13:20:39 -0500 (EST)
From: Igor Peshansky <pechtcha AT cs DOT nyu DOT edu>
Reply-To: cygwin AT cygwin DOT com
To: Pinaki Mukherjee <pinaki2003 AT yahoo DOT com>
cc: cygwin AT cygwin DOT com
Subject: Re: Calling shell script from DOS
In-Reply-To: <20060127062253.97104.qmail@web50102.mail.yahoo.com>
Message-ID: <Pine.GSO.4.63.0601271316520.27873@access1.cims.nyu.edu>
References: <20060127062253 DOT 97104 DOT qmail AT web50102 DOT mail DOT yahoo DOT com>
MIME-Version: 1.0
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

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.
HTH,
	Igor
-- 
				http://cs.nyu.edu/~pechtcha/
      |\      _,,,---,,_	    pechtcha AT cs DOT nyu DOT edu | igor AT watson DOT ibm DOT com
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:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019