From mboxrd@z Thu Jan 1 00:00:00 1970 From: Earnie Boyd To: Chris Marshall , "'cygwin@sourceware.cygnus.com'" Subject: Re: B20: declare built-in doesn't work in scripts, work around Date: Thu, 30 Dec 1999 12:20:00 -0000 Message-id: <19991230202018.5478.qmail@web116.yahoomail.com> X-SW-Source: 1999-12/msg00491.html --- 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 < mailto:earnie_boyd@yahoo.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@sourceware.cygnus.com From mboxrd@z Thu Jan 1 00:00:00 1970 From: Earnie Boyd To: Chris Marshall , "'cygwin@sourceware.cygnus.com'" Subject: Re: B20: declare built-in doesn't work in scripts, work around Date: Fri, 31 Dec 1999 13:28:00 -0000 Message-ID: <19991230202018.5478.qmail@web116.yahoomail.com> X-SW-Source: 1999-12n/msg00491.html Message-ID: <19991231132800.T2tO1rTQHYDxD-qIXmOYqeTrPPCVJl2ageUx_6jiVNY@z> --- 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 < mailto:earnie_boyd@yahoo.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@sourceware.cygnus.com