delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2006/11/22/00:24:40

X-Spam-Check-By: sourceware.org
From: "David Christensen" <dpchrist AT holgerdanske DOT com>
To: "'cygwin'" <cygwin AT cygwin DOT com>
Subject: RE: Help running bash scripts
Date: Tue, 21 Nov 2006 21:24:22 -0800
Message-ID: <001301c70df6$77e7e2f0$0a00a8c0@s3000p>
MIME-Version: 1.0
X-Mailer: Microsoft Office Outlook 11
In-reply-to: <4563C192.1020307@DeFaria.com>
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
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

Thierry wrote:
> running a simple sh script(test.sh):
> #!/bin/sh
> # test

> $ ./test.sh
> : command not found

Get this book:

    http://www.oreilly.com/catalog/bash3/index.html


"test" is a Bash built-in command ("man bash"; see CONDITIONAL
EXPRESSIONS).  Avoid using that keyword in Bash scripts and anywhere
else Bash might trip over it (such as script and program names).


So:

1.  Rename your script.

2.  Make it executable.

3.  Adjust your shebang line to point to Bash.  This is the location on
my Cygwin system:

	2006-11-21 21:11:50 dpchrist AT s3000p ~
	$ which bash
	/usr/bin/bash


4.  Try this:

	2006-11-21 21:11:51 dpchrist AT s3000p ~
	$ vi foo.sh
	#! /usr/bin/bash
	echo foo

	2006-11-21 21:16:39 dpchrist AT s3000p ~
	$ chmod +x foo.sh

	2006-11-21 21:16:44 dpchrist AT s3000p ~
	$ ./foo.sh
	foo


HTH,

David


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