This is the mail archive of the mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

question about local variables in bash for cygwin

Hello I have cygwin installed on my WinXP box and am loving it.  However
I just noticed today that when I tried to use the local keyword in my
bash script it gives me the error "local: not found".  The script works
on a RedHat box as expected so I would think that this is a cygwin/bash
problem.  Perhaps I am missing something really obvious, I am really a
C/C++ programmer and for the most part am just toying with bash
scripting trying to make an example of a return statement for my
professor who for some reason doesn't know how they work :P.  So, any
response would be great.

Thank you.

Evan Teran

Here is my bash version:
$ bash --version
GNU bash, version 2.05a.0(3)-release (i686-pc-cygwin)
Copyright 2001 Free Software Foundation, Inc.

Here is my example scipt:
------------start cut------------

    local SUM=0
    for i in $*
       # SUM=`expr $SUM + $i`
    return $SUM

# main body

# call the function
mySum $*

# put the value returned into variable A
# $? contains the return value of the last command executed

# print out our variable
echo $A
-------------end cut-------------

Unsubscribe info:
Bug reporting:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]