Subject: RE: CR/LF and read is shell scripts (and the cat command)
From: Eirik Nordbrøden <[email-masked]>
To: "[email-masked]" <[email-masked]>, <[email-masked]>
Cc: "Larry Hall (RFK Partners, Inc)" <[email-masked]>, "Earnie Boyd" <[email-masked]>, "Fifer, Eric" <[email-masked]>
Date: Wed, 23 Aug 2000 10:18:30 +0200

> -----Original Message-----
> From: Larry Hall (RFK Partners, Inc) [mailto:[email-masked]]
> Sent: 22. august 2000 18:27
> To: Earnie Boyd; Fifer, Eric; 'Eirik_Nordbrøden';
> [email-masked]
> Subject: RE: CR/LF and read is shell scripts
> 
> 
> At 11:58 AM 8/22/2000, Earnie Boyd wrote:
> >--- "Fifer, Eric" <[email-masked]> wrote:
> > > 
> > > >Anyone that has got an idea?
> > > 
> > > Try something like 'sed -n p' instead of 'cat'.
> > > 
> > > The cat currently included with cygwin does not
> > > work correctly on text mounts.  See my previous
> > > email for details.
> > > 
> >
> >Let me see if IIRC.  You, Eric Fifer, had said that cat is 
> forcing binary mode
> >file processing regardless of the text/binary mode default 
> settings.  Cat,
> >IIRC, comes from the textutils package.  This implies that cat is a text
> >utility and processing of files should default to text mode processing.
> >
> >IIRC, you had also suggested a switch --binmode for processing 
> binary files
> >with cat.  I believe that this should be the case.  So given 
> this cat should be
> >changed to:
> >
> >Process stdin in text mode and stdout in binary mode.
> >Process stdin and stdout in binary mode if --binmode is given.
> >Process stdin and stdout in text mode if --textmode is given.
> >Process stdin in binary if --binmode-in is given.
> >Process stdout in text mode if --textmode-out is given.
> >The switch --textmode-in and --binmode-out should also be supported.
> >
> >Comments?
> >
> >Cheers,
> >
> >=====
> >---
> >    Earnie Boyd: <mailto:[email-masked]>
> >             __Cygwin: POSIX on Windows__
> 
> 
> If you want my opinion, cat under Cygwin should open files using the MS
> text mode option (which reads text or binary files properly) and write 
> it as the target file system or pipe suggests by default.  The flags you
> suggest are fine options.  Of course, they should work on files and 
> stdin/stdout in the same way.
> 
> 
> Larry Hall                              [email-masked]
> RFK Partners, Inc.                      http://www.rfk.com
> 118 Washington Street                   (508) 893-9779 - RFK Office
> Holliston, MA 01746                     (508) 893-9889 - FAX
> 

Hello

I have concluded that the problem in my shell script is the implementation of the cat command. When I swapped the cat command in current version of cygwin with a cat command from an earlier version of cygwin, the script started working correctly. I do not know which version of cygwin this is, but I have included a printout of 'cygcheck -s -r -v' (see below). This problem is related to the discussions abow, but I do not know what is the correct way to handle this.
___________________________________________________

Eirik Nordbrøden    Tlf.        (+47) 69 21 27 18
Scandpower A/S      Fax.        (+47) 69 18 44 35
Os Alle 9           Tlf. priv.  (+47) 69 18 78 99
N-1777 Halden       Tlf. mobile (+47) 90 17 47 89
Norway

Email: mailto:[email-masked]
WWW:   http://www.scandpower.no/
___________________________________________________

/WINNT>cygchek -s -r -v
bash: cygchek: command not found
/WINNT>cygcheck -s -r -v

Cygnus Win95/NT Configuration Diagnostics
Current System Time: Wed Aug 23 08:52:11 2000

WinNT Ver 4.0 build 1381 Service Pack 5

Path:   //f/cygnus/CYGWIN~1/H-I586~1/bin
        /PW32
        /WINNT/system32
        /WINNT
        /exe
        /NTRESKIT
        /NTRESKIT/Perl
        //f/PROGRA~1/FULCRUM/BIN
        /sybase/DLL
        /sybase/BIN
        /sybtools/WIN32
        /sybtools/ASEP
        //d/BC5/BIN
        /program files/devstudio/sharedide/bin/ide
        /program files/devstudio/sharedide/bin
        /program files/devstudio/vc/bin
        //f/sqlany50/win32
        //f/sqlany50/win
        //f/sybtools/win32
        //f/sybase/dll
        //f/sybase/bin
        /BC45/BIN
        /bin
        /usr/fbr/bin
        /
        /Masm611/bin
        /exe
        /exe/cues

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

CYGWIN = `"tty"'
HOME = `/usr/fbr'
MAKE_MODE = `UNIX'
PWD = `/WINNT'

!C: = `C:\WINNT'
CLASSPATH = `c:\sybtools\ASEP\Monclass.zip;c:\sybtools\ASEP\3pclass.zip;'
COMPUTERNAME = `FBR'
COMSPEC = `C:\WINNT\system32\cmd.exe'
DISPLAY = `fbr:0.0'
HOMEDRIVE = `C:'
HOMEPATH = `\users\default'
HOSTNAME = `fbr'
HOSTTYPE = `i586'
INCLUDE = `c:\program files\devstudio\vc\include;c:\program files\devstudio\vc\atl\include;c:\program files\devstudio\vc\mfc\include;%includ
e%;c:\lib\x11r6\include'
LIB = `c:\program files\devstudio\vc\lib;c:\program files\devstudio\vc\mfc\lib;c:\sybase\LIB;c:\lib\x11r6\lib'
LOGONSERVER = `\\KYLIE'
MACHTYPE = `i586-pc-cygwin32'
MSDEVDIR = `C:\Program Files\DevStudio\SharedIDE'
NTRESKIT = `C:\NTRESKIT'
NUMBER_OF_PROCESSORS = `1'
OS2LIBPATH = `C:\WINNT\system32\os2\dll;'
OS = `Windows_NT'
OSTYPE = `cygwin32'
PATHEXT = `.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH'
PCSA = `C:\PW32'
PROCESSOR_ARCHITECTURE = `x86'
PROCESSOR_IDENTIFIER = `x86 Family 6 Model 1 Stepping 9, GenuineIntel'
PROCESSOR_LEVEL = `6'
PROCESSOR_REVISION = `0109'
PROMPT = `$P$G'
PS1 = ``pwd`>'
SCSI_DRIVER = `C:\IOMEGA '
SCSI_UTILITY = `C:\IOMEGA '
SHELL = `/bin/sh'
SHLVL = `1'
SQLANY = `f:\sqlany50'
SYBASE = `f:\sybase'
SYSTEMDRIVE = `C:'
SYSTEMROOT = `C:\WINNT'
TEMP = `C:\TEMP'
TERM = `cygwin'
TMP = `C:\TEMP'
USERDOMAIN = `HALDEN'
USERNAME = `FBR'
USERPROFILE = `C:\WINNT\Profiles\fbr.000'
WINDIR = `C:\WINNT'
_ = `//f/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) = `C:'
  unix = `/'
  fbinary = 0x00000000
  fsilent = 0x00000000
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin B20
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin B20\B20
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
  (default) = `f:\cygnus\cygwin-b20'
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Cygnus Cygwin B20
  (default) = `C:\WINNT\IsUninst.exe -ff:\cygnus\cygwin-b20\Uninst.isu'
  DisplayName = `Cygwin B20'

a:\ fd           N/A    N/A
c:\ hd  NTFS    1945Mb  98% CP CS UN PA FC     Frodo
d:\ hd  FAT      499Mb 100% CP    UN           EKSTRA DISK
e:\ cd  CDFS     280Mb 100%    CS              BCW_DTOOLS
f:\ hd  NTFS    6149Mb  37% CP CS UN PA FC     Gandalf
m:\ net NTFS   30765Mb  39% CP CS UN PA FC
n:\ net NTFS   30765Mb  39% CP CS UN PA FC
o:\ net NTFS    8056Mb  77% CP CS UN PA FC     apps
p:\ net FAT     1177Mb  94% CP    UN           BACKUP

C:    /        native  text!=binary

Found: f:\cygnus\CYGWIN~1\H-I586~1\bin\bash.exe
Found: C:\bin\bash.exe
Warning: f:\cygnus\CYGWIN~1\H-I586~1\bin\bash.exe hides C:\bin\bash.exe
Found: \bin\bash.exe
Warning: f:\cygnus\CYGWIN~1\H-I586~1\bin\bash.exe hides \bin\bash.exe
Found: f:\cygnus\CYGWIN~1\H-I586~1\bin\cat.exe
Found: C:\exe\cat.exe
Warning: f:\cygnus\CYGWIN~1\H-I586~1\bin\cat.exe hides C:\exe\cat.exe
Found: C:\NTRESKIT\cat.exe
Warning: f:\cygnus\CYGWIN~1\H-I586~1\bin\cat.exe hides C:\NTRESKIT\cat.exe
Found: C:\bin\cat.exe
Warning: f:\cygnus\CYGWIN~1\H-I586~1\bin\cat.exe hides C:\bin\cat.exe
Found: \bin\cat.exe
Warning: f:\cygnus\CYGWIN~1\H-I586~1\bin\cat.exe hides \bin\cat.exe
Found: d:\BC5\BIN\cpp.exe
Found: C:\BC45\BIN\cpp.exe
Warning: d:\BC5\BIN\cpp.exe hides C:\BC45\BIN\cpp.exe
Found: f:\cygnus\CYGWIN~1\H-I586~1\bin\find.exe
Found: C:\bin\find.exe
Warning: f:\cygnus\CYGWIN~1\H-I586~1\bin\find.exe hides C:\bin\find.exe
Found: \bin\find.exe
Warning: f:\cygnus\CYGWIN~1\H-I586~1\bin\find.exe hides \bin\find.exe
Found: f:\cygnus\CYGWIN~1\H-I586~1\bin\gcc.exe
Found: C:\bin\gcc.exe
Warning: f:\cygnus\CYGWIN~1\H-I586~1\bin\gcc.exe hides C:\bin\gcc.exe
Found: \bin\gcc.exe
Warning: f:\cygnus\CYGWIN~1\H-I586~1\bin\gcc.exe hides \bin\gcc.exe
Found: f:\cygnus\CYGWIN~1\H-I586~1\bin\gdb.exe
Found: C:\bin\gdb.exe
Warning: f:\cygnus\CYGWIN~1\H-I586~1\bin\gdb.exe hides C:\bin\gdb.exe
Found: \bin\gdb.exe
Warning: f:\cygnus\CYGWIN~1\H-I586~1\bin\gdb.exe hides \bin\gdb.exe
Found: f:\cygnus\CYGWIN~1\H-I586~1\bin\ld.exe
Found: C:\bin\ld.exe
Warning: f:\cygnus\CYGWIN~1\H-I586~1\bin\ld.exe hides C:\bin\ld.exe
Found: \bin\ld.exe
Warning: f:\cygnus\CYGWIN~1\H-I586~1\bin\ld.exe hides \bin\ld.exe
Found: f:\cygnus\CYGWIN~1\H-I586~1\bin\ls.exe
Found: C:\NTRESKIT\ls.exe
Warning: f:\cygnus\CYGWIN~1\H-I586~1\bin\ls.exe hides C:\NTRESKIT\ls.exe
Found: C:\bin\ls.exe
Warning: f:\cygnus\CYGWIN~1\H-I586~1\bin\ls.exe hides C:\bin\ls.exe
Found: \bin\ls.exe
Warning: f:\cygnus\CYGWIN~1\H-I586~1\bin\ls.exe hides \bin\ls.exe
Found: f:\cygnus\CYGWIN~1\H-I586~1\bin\make.exe
Found: d:\BC5\BIN\make.exe
Warning: f:\cygnus\CYGWIN~1\H-I586~1\bin\make.exe hides d:\BC5\BIN\make.exe
Found: C:\BC45\BIN\make.exe
Warning: f:\cygnus\CYGWIN~1\H-I586~1\bin\make.exe hides C:\BC45\BIN\make.exe
Found: C:\bin\make.exe
Warning: f:\cygnus\CYGWIN~1\H-I586~1\bin\make.exe hides C:\bin\make.exe
Found: \bin\make.exe
Warning: f:\cygnus\CYGWIN~1\H-I586~1\bin\make.exe hides \bin\make.exe
Found: f:\cygnus\CYGWIN~1\H-I586~1\bin\sh.exe
Found: C:\bin\sh.exe
Warning: f:\cygnus\CYGWIN~1\H-I586~1\bin\sh.exe hides C:\bin\sh.exe
Found: \bin\sh.exe
Warning: f:\cygnus\CYGWIN~1\H-I586~1\bin\sh.exe hides \bin\sh.exe

  371k 1998/12/01 f:\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 9:25
    5k 1998/12/01 f:\cygnus\CYGWIN~1\H-I586~1\bin\cygtclpip80.dll - os=4.0 img=1.0 sys=4.0
   10k 1998/12/01 f:\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 9:25
  600k 1998/12/01 f:\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 9:28
  446k 1998/12/03 f:\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/4 5:39
  371k 1998/12/01 C:\bin\cygtcl80.dll - os=4.0 img=1.0 sys=4.0
                  "cygtcl80.dll" v0.0 ts=1998/12/1 9:25
    5k 1998/12/01 C:\bin\cygtclpip80.dll - os=4.0 img=1.0 sys=4.0
   10k 1998/12/01 C:\bin\cygtclreg80.dll - os=4.0 img=1.0 sys=4.0
                  "cygtclreg80.dll" v0.0 ts=1998/12/1 9:25
  600k 1998/12/01 C:\bin\cygtk80.dll - os=4.0 img=1.0 sys=4.0
                  "cygtk80.dll" v0.0 ts=1998/12/1 9:28
  446k 1998/12/03 C:\bin\cygwin1.dll - os=4.0 img=1.0 sys=4.0
                  "cygwin1.dll" v0.0 ts=1998/12/4 5:39
  371k 1998/12/01 \bin\cygtcl80.dll - os=4.0 img=1.0 sys=4.0
                  "cygtcl80.dll" v0.0 ts=1998/12/1 9:25
    5k 1998/12/01 \bin\cygtclpip80.dll - os=4.0 img=1.0 sys=4.0
   10k 1998/12/01 \bin\cygtclreg80.dll - os=4.0 img=1.0 sys=4.0
                  "cygtclreg80.dll" v0.0 ts=1998/12/1 9:25
  600k 1998/12/01 \bin\cygtk80.dll - os=4.0 img=1.0 sys=4.0
                  "cygtk80.dll" v0.0 ts=1998/12/1 9:28
  446k 1998/12/03 \bin\cygwin1.dll - os=4.0 img=1.0 sys=4.0
                  "cygwin1.dll" v0.0 ts=1998/12/4 5:39
Use -h to see help about each section
/WINNT>