functions in /bin/sh scripts causing "unexpected "("" errors

Kristin Wright l.kristin.wright@gmail.com
Wed Aug 17 18:03:00 GMT 2005


I searched the archives, FAQ and general web but didn't find an answer for this.

I'm observing the following error when I attempt to run shell scripts
with  functions in a cygwin shell. These scripts work as expected on
my linux machines.

$ ./functest
./functest: 3: Syntax error: "(" unexpected
$ cat functest
#!/bin/sh

function helloworld () {
        echo "Hello, World!"
}

helloworld();

(The functest script above is attached as is my output to cygcheck.)

I also found that if I uncommented the example function line included
in /etc/skel/.bashrc, the same error resulted. The line is:

# Some example functions
function settitle() { echo -n "^[]2;$@^G^[]1;$@^G"; }

I'm guessing that this is a bug in this particular version of sh on
cygwin but, as I mentioned above, I haven't been able to find anything
on it  -- perhaps because the error is so common in programming so
there's too much other information.

Any ideas?

Thank you.

-kw
-------------- next part --------------
A non-text attachment was scrubbed...
Name: functest
Type: application/octet-stream
Size: 80 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin/attachments/20050817/afa68e7a/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cygcheck.out
Type: application/octet-stream
Size: 17412 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin/attachments/20050817/afa68e7a/attachment-0001.obj>
-------------- next part --------------
--
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/


More information about the Cygwin mailing list