public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* B20: declare built-in doesn't work in scripts, work around
@ 1999-12-30 11:24 Chris Marshall
  1999-12-30 11:38 ` Doug Wyatt
  1999-12-31 13:28 ` Chris Marshall
  0 siblings, 2 replies; 8+ messages in thread
From: Chris Marshall @ 1999-12-30 11:24 UTC (permalink / raw)
  To: 'cygwin@sourceware.cygnus.com'

I am using beta 20.0 under NT 4.0.

Running the following script:

	declare -i count
	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 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

WinNT Ver 4.0 build 1381 Service Pack 5

Path:	/home/d/cygnus/CYGWIN~1/H-I586~1/bin
	/WINNT/system32
	/WINNT
	/Program Files/Exceed.nt
	/home/d/devstudio/sharedide/bin/ide
	/home/d/devstudio/sharedide/bin
	/home/d/devstudio/vc/bin
	/home/d/bc5/bin
	/jdk1.2/bin

SysDir: C:\WINNT\System32
WinDir: C:\WINNT

MAKE_MODE = `UNIX'
PWD = `/home/f/data analysis/1299/sniffer'

!C: = `C:\'
CLASSPATH = `c:\my documents\programs\java\classes;.'
COMPUTERNAME = `CHRISM1'
COMSPEC = `C:\WINNT\system32\cmd.exe'
HOMEDRIVE = `C:'
HOMEPATH = `\'
HOSTNAME = `chrism1'
HOSTTYPE = `i586'
INCLUDE =
`d:\devstudio\vc\include;d:\devstudio\vc\atl\include;d:\devstudio\vc\mfc\inc
lude;%include%'
LIB = `d:\devstudio\vc\lib;d:\devstudio\vc\mfc\lib;%lib%'
LOGONSERVER = `\\NORCOM2'
MACHTYPE = `i586-pc-cygwin32'
MSDEVDIR = `D:\DevStudio\SharedIDE'
NUMBER_OF_PROCESSORS = `1'
NUTHENA = `C:\foresight'
OS2LIBPATH = `C:\WINNT\system32\os2\dll;'
OS = `Windows_NT'
OSTYPE = `cygwin32'
PATHEXT = `.COM;.EXE;.BAT;.CMD'
PROCESSOR_ARCHITECTURE = `x86'
PROCESSOR_IDENTIFIER = `x86 Family 6 Model 7 Stepping 2, GenuineIntel'
PROCESSOR_LEVEL = `6'
PROCESSOR_REVISION = `0702'
PROMPT = `$P$G'
SHELL = `/bin/sh'
SHLVL = `1'
SYSTEMDRIVE = `C:'
SYSTEMROOT = `C:\WINNT'
TEMP = `C:\TEMP'
TERM = `cygwin'
TMP = `C:\TEMP'
USERDOMAIN = `NORCOM.NET'
USERNAME = `chrism'
USERPROFILE = `C:\WINNT\Profiles\chrism'
WINDIR = `C:\WINNT'
_ = `/home/d/cygnus/CYGWIN~1/H-I586~1/bin/cygcheck'

HKEY_CURRENT_USER\Software\Cygnus Solutions
HKEY_CURRENT_USER\Software\Cygnus Solutions\CYGWIN.DLL setup
HKEY_CURRENT_USER\Software\Cygnus Solutions\CYGWIN.DLL setup\b15.0
HKEY_CURRENT_USER\Software\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts
HKEY_CURRENT_USER\Software\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\00
  (default) = `f:'
  unix = `/home/f'
  fbinary = 0x00000000
  fsilent = 0x00000000
HKEY_CURRENT_USER\Software\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\01
  (default) = `d:'
  unix = `/home/d'
  fbinary = 0x00000000
  fsilent = 0x00000000
HKEY_CURRENT_USER\Software\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\02
  (default) = `C:'
  unix = `/'
  fbinary = 0x00000000
  fsilent = 0x00000001
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\MenuOrd
er\Start Menu\&Programs\Cygnus Solutions
  (default) = (unsupported type)
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin B20
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin B20\B20.1
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL
setup\b15.0\mounts\00
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL
setup\b15.0\mounts\01
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL
setup\b15.0\mounts\02
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL
setup\b15.0\mounts\03
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL
setup\b15.0\mounts\04
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL
setup\b15.0\mounts\05
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL
setup\b15.0\mounts\06
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL
setup\b15.0\mounts\07
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL
setup\b15.0\mounts\08
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL
setup\b15.0\mounts\09
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL
setup\b15.0\mounts\0A
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL
setup\b15.0\mounts\0B
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL
setup\b15.0\mounts\0C
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL
setup\b15.0\mounts\0D
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL
setup\b15.0\mounts\0E
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL
setup\b15.0\mounts\0F
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL
setup\b15.0\mounts\10
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL
setup\b15.0\mounts\11
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL
setup\b15.0\mounts\12
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL
setup\b15.0\mounts\13
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL
setup\b15.0\mounts\14
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL
setup\b15.0\mounts\15
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL
setup\b15.0\mounts\16
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL
setup\b15.0\mounts\17
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL
setup\b15.0\mounts\18
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL
setup\b15.0\mounts\19
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL
setup\b15.0\mounts\1A
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL
setup\b15.0\mounts\1B
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL
setup\b15.0\mounts\1C
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL
setup\b15.0\mounts\1D
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\GNUPro
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\GNUPro\i586-cygwin32
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus
Solutions\GNUPro\i586-cygwin32\i586-cygwin32
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus
Solutions\GNUPro\i586-cygwin32\i586-cygwin32\cygwin-B20.1
  (default) = `d:\cygnus\cygwin-b20'
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Cygnu
s Cygwin B20
  (default) = `C:\WINNT\IsUninst.exe -fd:\cygnus\cygwin-b20\Uninst.isu'
  DisplayName = `Cygwin B20'

a:\ fd           N/A    N/A                    
c:\ hd  NTFS    4016Mb  64% CP CS UN PA FC     
d:\ hd  NTFS    3498Mb  49% CP CS UN PA FC     
e:\ cd           N/A    N/A                    
f:\ hd  NTFS   12958Mb  42% CP CS UN PA FC     
g:\ fd           N/A    N/A                    
h:\ net NTFS    4337Mb  58% CP CS UN PA FC     

C:    /        native  text!=binary
d:    /home/d  native  text!=binary
f:    /home/f  native  text!=binary

Found: d:\cygnus\CYGWIN~1\H-I586~1\bin\bash.exe
Found: d:\cygnus\CYGWIN~1\H-I586~1\bin\cat.exe
Found: d:\bc5\bin\cpp.exe
Found: d:\cygnus\CYGWIN~1\H-I586~1\bin\find.exe
Found: d:\cygnus\CYGWIN~1\H-I586~1\bin\gcc.exe
Found: d:\cygnus\CYGWIN~1\H-I586~1\bin\gdb.exe
Found: d:\cygnus\CYGWIN~1\H-I586~1\bin\ld.exe
Found: d:\cygnus\CYGWIN~1\H-I586~1\bin\ls.exe
Found: d:\cygnus\CYGWIN~1\H-I586~1\bin\make.exe
Found: d:\bc5\bin\make.exe
Warning: d:\cygnus\CYGWIN~1\H-I586~1\bin\make.exe hides d:\bc5\bin\make.exe
Found: d:\cygnus\CYGWIN~1\H-I586~1\bin\sh.exe

  371k 1998/12/01 d:\cygnus\CYGWIN~1\H-I586~1\bin\cygtcl80.dll - os=4.0
img=1.0 sys=4.0
                  "cygtcl80.dll" v0.0 ts=1998/12/1 3:25
    5k 1998/12/01 d:\cygnus\CYGWIN~1\H-I586~1\bin\cygtclpip80.dll - os=4.0
img=1.0 sys=4.0
   10k 1998/12/01 d:\cygnus\CYGWIN~1\H-I586~1\bin\cygtclreg80.dll - os=4.0
img=1.0 sys=4.0
                  "cygtclreg80.dll" v0.0 ts=1998/12/1 3:25
  600k 1998/12/01 d:\cygnus\CYGWIN~1\H-I586~1\bin\cygtk80.dll - os=4.0
img=1.0 sys=4.0
                  "cygtk80.dll" v0.0 ts=1998/12/1 3:28
  446k 1998/12/04 d:\cygnus\CYGWIN~1\H-I586~1\bin\cygwin1.dll - os=4.0
img=1.0 sys=4.0
                  "cygwin1.dll" v0.0 ts=1998/12/3 23:39


--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com

^ permalink raw reply	[flat|nested] 8+ messages in thread
[parent not found: <00D9FFC41AA5D211BA1200A0C992CE010564DF@NORCOM2>]
* Re: B20: declare built-in doesn't work in scripts, work around
@ 1999-12-30 12:20 Earnie Boyd
  1999-12-31 13:28 ` Earnie Boyd
  0 siblings, 1 reply; 8+ messages in thread
From: Earnie Boyd @ 1999-12-30 12:20 UTC (permalink / raw)
  To: Chris Marshall, 'cygwin@sourceware.cygnus.com'

--- Chris Marshall <chrism@NORCOM.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@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

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~1999-12-31 13:28 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-12-30 11:24 B20: declare built-in doesn't work in scripts, work around Chris Marshall
1999-12-30 11:38 ` Doug Wyatt
1999-12-31 13:28   ` Doug Wyatt
1999-12-31 13:28 ` Chris Marshall
     [not found] <00D9FFC41AA5D211BA1200A0C992CE010564DF@NORCOM2>
1999-12-30 12:13 ` Doug Wyatt
1999-12-31 13:28   ` Doug Wyatt
1999-12-30 12:20 Earnie Boyd
1999-12-31 13:28 ` Earnie Boyd

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).