X-Spam-Check-By: sourceware.org From: "Herb Martin" To: Subject: RE: Calling shell script from DOS Date: Fri, 27 Jan 2006 17:12:13 -0600 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit In-Reply-To: Message-ID: X-Sign-LQC: HerbM AT learnquick DOT com/2006-01-27 17:12:18/=vlgfqaoo Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , 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/