CR/LF and read is shell scripts
Eirik Nordbrøden
eirik.nordbroden@scandpower.no
Tue Aug 22 07:09:00 GMT 2000
Hello
I have not bin able to solve the CR/LF problem and the read statement. My version of cygwin is 1.1.4. Included is the failing shell script (the variable last_name contains a CR when I run it). Also included is the output from 'cygcheck -s -r -v'.
Anyone that has got an idea?
--- Script: ---
#!/bin/sh
temp_file=/tmp/names.tmp
rm -f $temp_file
touch $temp_file
echo "Ole Olsen" >> $temp_file
echo "Per Pettersen" >> $temp_file
echo "Hans Hansen" >> $temp_file
cat $temp_file |
while read first_name last_name junk
do
echo "$last_name, $first_name"
done
--- 'cygcheck -s -r -v' ---
Cygnus Win95/NT Configuration Diagnostics
Current System Time: Tue Aug 22 16:01:26 2000
WinNT Ver 4.0 build 1381 Service Pack 5
Path: /usr/bin
/cygdrive/c/winnt/system32
/cygdrive/c/winnt
/cygdrive/c/WINNT/system32
/cygdrive/c/WINNT
/cygdrive/c/program files/emacs/20.3.1/bin
/cygdrive/c/Tools
/cygdrive/c/program files/Sybase/DLL
/cygdrive/c/program files/Sybase/BIN
/cygdrive/c/sybtools/WIN32
/cygdrive/c/sybtools/ASEP
/cygdrive/c/Program Files/jdk1.2.2/bin
/usr/bin
/home/eno/bin
/cygdrive/c/mri
/cygdrive/c/mri/mcc68k
/cygdrive/c/mri/asm68k
.
SysDir: C:\WINNT\System32
WinDir: C:\WINNT
CYGWIN = `"tty"'
HOME = `/cygdrive/c/cygwin/home/eno'
MAKE_MODE = `UNIX'
PWD = `/home/eno'
!C: = `C:\cygwin\home\eno'
ARCOR_SW = `m:\avd33\atn\telettra\335207\code\testnecp'
BTIMS_SW = `m:\avd33\AxxessIT\335408\Code\AsdhSw'
BTIMS_SW_MLSC_INTEGRATION = `m:\avd33\atn\telettra\335208\code\mlscintegration'
BTIMS_SW_SNMP_STEP_2 = `m:\avd33\AxxessIT\335405\Code\SnmpSw'
BTIMS_SW_STEP_2 = `m:\avd33\AxxessIT\335405\Code\BTStep2'
BTIMS_SW_STEP_3 = `m:\avd33\AxxessIT\335408\Code\AsdhSw'
COMPUTERNAME = `ENO'
COMSPEC = `C:\WINNT\system32\cmd.exe'
HOMEDRIVE = `c:'
HOMEPATH = `\'
HOSTNAME = `ENO'
HOSTTYPE = `i586'
LIB = `c:\program files\sybase\LIB'
LOGONSERVER = `\\KYLIE'
MACHTYPE = `i586-pc-cygwin'
MANPATH = `/cygdrive/c/cygwin/usr/man'
MRI_68K_INC = `c:\mri\mcc68k'
NUMBER_OF_PROCESSORS = `1'
OS2LIBPATH = `C:\WINNT\system32\os2\dll;'
OS = `Windows_NT'
OSTYPE = `cygwin'
PATHEXT = `.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH'
PROCESSOR_ARCHITECTURE = `x86'
PROCESSOR_IDENTIFIER = `x86 Family 6 Model 1 Stepping 9, GenuineIntel'
PROCESSOR_LEVEL = `6'
PROCESSOR_REVISION = `0109'
PROMPT = `$P$G'
PS1 = ``pwd`>'
SHELL = `/bin/sh'
SHLVL = `1'
SYBASE = `c:\program files\Sybase'
SYSTEMDRIVE = `C:'
SYSTEMROOT = `C:\WINNT'
TEMP = `/cygdrive/c/TEMP'
TERM = `cygwin'
TMP = `/cygdrive/c/TEMP'
USERDOMAIN = `HALDEN'
USERNAME = `ENO'
USERPROFILE = `C:\WINNT\Profiles\eno'
USR_MRI = `c:\mri'
WINDIR = `C:\WINNT'
_ = `/usr/bin/cygcheck'
TZ = `WEST-1WEDT-2,M3.5.0/2,M10.5.0/3'
HKEY_CURRENT_USER\Console\Cygnus
(default) = 0x000000f0
PopupColors = 0x000000f9
ColorTable00 = 0x00000000
ColorTable01 = 0x00800000
ColorTable02 = 0x00008000
ColorTable03 = 0x00808000
ColorTable04 = 0x00000080
ColorTable05 = 0x00800080
ColorTable06 = 0x00008080
ColorTable07 = 0x00c0c0c0
ColorTable08 = 0x00808080
ColorTable09 = 0x00ff0000
ColorTable10 = 0x0000ff00
ColorTable11 = 0x00ffff00
ColorTable12 = 0x000000ff
ColorTable13 = 0x00ff00ff
ColorTable14 = 0x0000ffff
ColorTable15 = 0x00ffffff
InsertMode = 0x00000000
QuickEdit = 0x00000000
FullScreen = 0x00000000
ScreenBufferSize = 0x03e70078
WindowSize = 0x00320078
FontSize = 0x000c0008
FontFamily = 0x00000030
FontWeight = 0x00000190
FaceName = `Terminal'
CursorSize = 0x00000019
HistoryBufferSize = 0x00000032
NumberOfHistoryBuffers = 0x00000004
HistoryNoDup = 0x00000000
HKEY_CURRENT_USER\Software\Cygnus Solutions
HKEY_CURRENT_USER\Software\Cygnus Solutions\Cygwin
HKEY_CURRENT_USER\Software\Cygnus Solutions\Cygwin\mounts v2
(default) = `/cygdrive'
cygdrive flags = 0x00000020
HKEY_CURRENT_USER\Software\Cygnus Solutions\Cygwin\Program Options
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
HKEY_CURRENT_USER\Software\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\01
HKEY_CURRENT_USER\Software\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\02
HKEY_CURRENT_USER\Software\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\03
HKEY_CURRENT_USER\Software\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\04
HKEY_CURRENT_USER\Software\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\05
HKEY_CURRENT_USER\Software\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\06
HKEY_CURRENT_USER\Software\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\07
HKEY_CURRENT_USER\Software\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\08
HKEY_CURRENT_USER\Software\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\09
HKEY_CURRENT_USER\Software\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\0A
HKEY_CURRENT_USER\Software\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\0B
HKEY_CURRENT_USER\Software\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\0C
HKEY_CURRENT_USER\Software\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\0D
HKEY_CURRENT_USER\Software\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\0E
HKEY_CURRENT_USER\Software\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\0F
HKEY_CURRENT_USER\Software\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\10
HKEY_CURRENT_USER\Software\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\11
HKEY_CURRENT_USER\Software\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\12
HKEY_CURRENT_USER\Software\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\13
HKEY_CURRENT_USER\Software\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\14
HKEY_CURRENT_USER\Software\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\15
HKEY_CURRENT_USER\Software\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\16
HKEY_CURRENT_USER\Software\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\17
HKEY_CURRENT_USER\Software\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\18
HKEY_CURRENT_USER\Software\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\19
HKEY_CURRENT_USER\Software\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\1A
HKEY_CURRENT_USER\Software\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\1B
HKEY_CURRENT_USER\Software\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\1C
HKEY_CURRENT_USER\Software\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\1D
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\mounts v2
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\mounts v2\/
(default) = `C:/cygwin'
flags = 0x00000008
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\mounts v2\/usr/bin
(default) = `C:/cygwin/bin'
flags = 0x00000008
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\mounts v2\/usr/lib
(default) = `C:/cygwin/lib'
flags = 0x00000008
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
a: fd N/A N/A
c: hd NTFS 2445Mb 81% CP CS UN PA FC
d: cd N/A N/A
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:\cygwin\bin /usr/bin system textmode
C:\cygwin\lib /usr/lib system textmode
C:\cygwin / system textmode
Found: C:\cygwin\bin\bash.exe
Found: C:\cygwin\bin\cat.exe
Found: C:\cygwin\bin\cpp.exe
Found: C:\cygwin\bin\find.exe
Found: C:\cygwin\bin\gcc.exe
Found: C:\cygwin\bin\gdb.exe
Found: C:\cygwin\bin\ld.exe
Found: C:\cygwin\bin\ls.exe
Found: C:\cygwin\bin\make.exe
Found: c:\Tools\make.exe
Warning: C:\cygwin\bin\make.exe hides c:\Tools\make.exe
Found: C:\cygwin\bin\sh.exe
83k 2000/06/11 C:\cygwin\bin\cygitcl30.dll - os=4.0 img=1.0 sys=4.0
"cygitcl30.dll" v0.0 ts=2000/6/11 5:34
35k 2000/06/11 C:\cygwin\bin\cygitk30.dll - os=4.0 img=1.0 sys=4.0
"cygitk30.dll" v0.0 ts=2000/6/11 5:34
402k 2000/06/11 C:\cygwin\bin\cygtcl80.dll - os=4.0 img=1.0 sys=4.0
"cygtcl80.dll" v0.0 ts=2000/6/11 5:30
5k 2000/06/11 C:\cygwin\bin\cygtclpip80.dll - os=4.0 img=1.0 sys=4.0
10k 2000/06/11 C:\cygwin\bin\cygtclreg80.dll - os=4.0 img=1.0 sys=4.0
"cygtclreg80.dll" v0.0 ts=2000/6/11 5:30
639k 2000/06/11 C:\cygwin\bin\cygtk80.dll - os=4.0 img=1.0 sys=4.0
"cygtk80.dll" v0.0 ts=2000/6/11 5:34
586k 2000/08/04 C:\cygwin\bin\cygwin1.dll - os=4.0 img=1.0 sys=4.0
"cygwin1.dll" v0.0 ts=2000/8/4 2:53
Cygwin DLL version info:
dll major: 1001
dll minor: 4
dll epoch: 19
dll bad signal mask: 19005
dll old termios: 5
api major: 0
api minor: 26
shared data: 3
dll identifier: cygwin1
mount registry: 2
cygnus registry name: Cygnus Solutions
cygwin registry name: Cygwin
program options name: Program Options
cygwin mount registry name: mounts v2
build date: Thu Aug 3 20:53:46 EDT 2000
CVS tag: cygwin-1-1-4
shared id: cygwin1S3
Use -h to see help about each section
___________________________________________________
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:eirik.nordbroden@scandpower.no
WWW: http://www.scandpower.no/
___________________________________________________
> -----Original Message-----
> From: Earnie Boyd [ mailto:earnie_boyd@yahoo.com ]
> Sent: 18. august 2000 14:05
> To: Eirik_Nordbrden; cygwin@sourceware.cygnus.com
> Subject: Re: CR/LF and read is shell scripts
>
>
> --- Eirik_Nordbrøden <eirik.nordbroden@scandpower.no> wrote:
> > Hello
> >
> > I have just installed cygwin on my NT workstation and have a
> problem with a
> > shell script. The script generates a temporary file by the use
> of the echo
> > statement and later on the content is evaluated with a cat and
> consecutive
> > read statements. The problem is that the generated file
> contains CRLF at the
> > end of each line, but the read statement only recognises the LF
> and therefore
> > adds CR to the last variable read. I do not want to change the
> script so I
> > wonder if this is an installation problem or if there are some
> other way to
> > get around it. At installation I choose the option to treat all
> text files as
> > MS Dos files.
> >
>
> Output pasted into a mail from `cygcheck -s -r -v' would be
> useful. Post it to
> the list not to me. BTW, I'm guessing that you're using non-Cygwin tools
> somewhere along the way.
>
> Cheers,
>
> =====
> ---
> Earnie Boyd: < mailto:earnie_boyd@yahoo.com >
> __Cygwin: POSIX on Windows__
> Cygwin Newbies: < http://gw32.freeyellow.com/ >
> __Minimalist GNU for Windows__
> Mingw32 List: < http://www.egroups.com/group/mingw32/ >
> Mingw Home: < http://www.mingw.org/ >
>
> __________________________________________________
> Do You Yahoo!?
> Send instant messages & get email alerts with Yahoo! Messenger.
> http://im.yahoo.com/
>
More information about the Cygwin
mailing list