Eric Blake <eblake <at> redhat.com> writes: > > On 03/18/2011 01:43 AM, Ralf wrote: > > I'm using cygwin under windows to change text-files with windows line-endings > > (CR and LF). I wrote a lot of shell-scripts which call each other. The > > filenames in those scripts are sometimes given als windows filenames (e.g. > > c:\temp\file.txt) sometimes relative (e.g. ../tmp/file.txt) sometimes as unix > > filenames (e.g. /c/temp/file.txt) and sometimes without any directory (e.g. > > file.txt) > > > > The current versions of cygwin now only use entries from fstab to determine > > the mode but this will break all my scripts because the same file will > > sometimes be treated as binary (filename c:\temp\file.txt) and sometimes as > > text (filename /c/temp/file.txt). > > > > So is there a way to say 'use always textmode' like it was possible in former > > releases? > > Use cygpath to convert the filename to POSIX style, so that you never > open a DOS path. >
So I have to go to all my shell scripts (some 1000 lines) and have to find out which parameters are filenames and which ones not. This will take some weeks. Is there no global flag to control this? I can not understand why this feature has been dropped. In an windows environment the new behaviour is very confusing. Here an example how sh.exe behaves: C:\sw\bin>mount C:/unix/bin on /usr/bin type ntfs (binary,auto) C:/unix/lib on /usr/lib type ntfs (binary,auto) C:/unix on / type ntfs (binary,auto) C: on /c type ntfs (text,posix=0,user,noumount,auto) D: on /d type ntfs (text,posix=0,user,noumount,auto) S: on /s type ntfs (text,posix=0,user,noumount,auto) Z: on /z type ntfs (text,posix=0,user,noumount,auto) C:\sw\bin>sh twg.sh ok C:\sw\bin>sh ./twg.sh ok C:\sw\bin>sh .\twg.sh .\twg.sh: line 2: syntax error near unexpected token `$'in\r'' '\twg.sh: line 2: ` case "$funk" in C:\sw\bin>sh c:\sw\bin\twg.sh c:\sw\bin\twg.sh: line 2: syntax error near unexpected token `$'in\r'' ':\sw\bin\twg.sh: line 2: ` case "$funk" in C:\sw\bin> I know "d2u c:\sw\bin\twg.sh" will solve this particular problem but this will not solve the problems with all the windows files twg.sh reads and writes. I understand that it can be helpful to make it dependent from the filesystem but if you use cygwin as an helpful tool in an pure windows environment it's now confusing and error-prone. In the past I didn't have to pay attention to line endings. All programs (windows and cygwin) used CR LF. But now I have to look at each called program do find out wich line-endings are written. I think it's hard to understand that the same input gives different results depending on filenames. You can see a lot of posts here which are about this problem. So is there a chance to get back the global setting of textmode, or is there a way to get textmode without changing all the scripts? -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple