delorie.com/archives/browse.cgi | search |
Mailing-List: | contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm |
List-Subscribe: | <mailto:cygwin-subscribe AT sourceware DOT cygnus DOT com> |
List-Archive: | <http://sourceware.cygnus.com/ml/cygwin/> |
List-Post: | <mailto:cygwin AT sourceware DOT cygnus DOT com> |
List-Help: | <mailto:cygwin-help AT sourceware DOT cygnus DOT com>, <http://sourceware.cygnus.com/ml/#faqs> |
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 <earnie_boyd AT yahoo DOT com> |
Reply-To: | earnie_boyd AT yahoo DOT com |
Subject: | Re: B20: declare built-in doesn't work in scripts, work around |
To: | Chris Marshall <chrism AT NORCOM DOT NET>, |
"'cygwin AT sourceware DOT cygnus DOT com'" <cygwin AT sourceware DOT cygnus DOT com> | |
MIME-Version: | 1.0 |
--- Chris Marshall <chrism AT NORCOM DOT NET> 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 <mailto:earnie_boyd AT yahoo DOT com> Cygwin Newbies, please visit <http://www.freeyellow.com/members5/gw32/index.html> __________________________________________________ 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
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |