delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2006/01/27/18:12:47

X-Spam-Check-By: sourceware.org
From: "Herb Martin" <HerbM AT learnquick DOT com>
To: <cygwin AT cygwin DOT com>
Subject: RE: Calling shell script from DOS
Date: Fri, 27 Jan 2006 17:12:13 -0600
MIME-Version: 1.0
In-Reply-To: <Pine.GSO.4.63.0601271316520.27873@access1.cims.nyu.edu>
Message-ID: <EITRXSR-000GW0-4C@mail2.learnquick.com>
X-Sign-LQC: HerbM AT learnquick DOT com/2006-01-27 17:12:18/<cygwin AT cygwin DOT com>=vlgfqaoo
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

> > 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/

- Raw text -


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