This is the mail archive of the
cygwin
mailing list for the Cygwin project.
RE: Help running bash scripts
- From: "David Christensen" <dpchrist at holgerdanske dot com>
- To: "'cygwin'" <cygwin at cygwin dot com>
- Date: Tue, 21 Nov 2006 21:24:22 -0800
- Subject: RE: Help running bash scripts
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@s3000p ~
$ which bash
/usr/bin/bash
4. Try this:
2006-11-21 21:11:51 dpchrist@s3000p ~
$ vi foo.sh
#! /usr/bin/bash
echo foo
2006-11-21 21:16:39 dpchrist@s3000p ~
$ chmod +x foo.sh
2006-11-21 21:16:44 dpchrist@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/