Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT sourceware DOT cygnus DOT com Delivered-To: mailing list cygwin AT sourceware DOT cygnus DOT com Message-ID: <19991230202018.5478.qmail@web116.yahoomail.com> Date: Thu, 30 Dec 1999 12:20:18 -0800 (PST) From: Earnie Boyd Reply-To: earnie_boyd AT yahoo DOT com Subject: Re: B20: declare built-in doesn't work in scripts, work around To: Chris Marshall , "'cygwin AT sourceware DOT cygnus DOT com'" MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii --- Chris Marshall wrote: > I am using beta 20.0 under NT 4.0. > > Running the following script: > > declare -i count A bashism. Isn't supported by sh. > count=0 > count=count+1 > count=count+1 > echo count is ${count} > > should produce the output: > > count is 2 > > but instead produces the output: > > declare: not found > count is count+1 > > If the above script is in the file "do_it" and I run it from the bash > command line by typing "./doit" I get the wrong output. > If your here document is #!/bin/sh then you're not executing the script under bash but under sh and the two aren't the same. Again, declare is a bashism. If your here document is #!/bin/bash then the script will work correctly. > If I run it with "source ./doit" it works correctly. > > A better work-around to use in general is "( source ./doit )" so that when > the "exit" command appears in the script you are executing, the bash command > shell doesn't disappear. > > Chris Marshall > > p.s. Here is the output of cygcheck -s -v -r for my machine: > Cygnus Win95/NT Configuration Diagnostics > Current System Time: Thu Dec 30 14:15:43 1999 > -8<- I notice that you have no HOME variable. Also, you're using the stock b20.1 Cygwin1.dll. Please read my webpage. ===== Earnie Boyd Cygwin Newbies, please visit __________________________________________________ Do You Yahoo!? Talk to your friends online with Yahoo! Messenger. http://messenger.yahoo.com -- Want to unsubscribe from this list? Send a message to cygwin-unsubscribe AT sourceware DOT cygnus DOT com