echo and CYGWIN variable

Igor Pechtchanski pechtcha@cs.nyu.edu
Wed May 21 14:47:00 GMT 2003


On Wed, 21 May 2003 Rolf.Guigas@t-online.de wrote:

> I am using CYGWIN bash 2.05b-9 under W2K and want to force output of
> echo to be always textmode.
>
> Echo to a Windows-File (Drive or UNC-Specification) results in unix NL
> format, despite setting of CYGWIN=nobinmode before invoking bash:
>
>     bash> echo "something" >> 'd:/tmp/file.log'
>     bash> echo "something" >> '//server/share/file.log'
>
>
> Echo to mounted filesystem results as expected in DOS CR+LF format:
>
>     bash> echo "something" >> '/cygwin/d/file.log'
>
>
> Does echo - utility disregard CYGWIN - Variable ?
>
> Thanks in advance for your help.
> Rolf Guigas

Rolf,

Whenever you redirect to a file, the mount table is consulted, and the
appropriate mode is selected (i.e., CYGWIN has no effect).  If you use
Win32 paths, there are no entries in the mount table, so I'm not quite
sure what's going on.  You could try using backslashes instead of forward
slashes (I think those force textmode), i.e., use ">> 'd:\tmp\file.log'"
instead of ">> 'd:/tmp/file.log'".  Other things to try would be /bin/echo
or "echo something | cat >> 'd:/tmp/file.log'" and see if that works.  If
all else fails, try running "strace" on the echo command (you'll need to
trace the redirection as well, so you might be better off using "strace
bash -c 'echo something >> d:/tmp/file.log'"), and see if it provides any
clues.
	Igor
-- 
				http://cs.nyu.edu/~pechtcha/
      |\      _,,,---,,_		pechtcha@cs.nyu.edu
ZZZzz /,`.-'`'    -.  ;-;;,_		igor@watson.ibm.com
     |,4-  ) )-,_. ,\ (  `'-'		Igor Pechtchanski
    '---''(_/--'  `-'\_) fL	a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

"I have since come to realize that being between your mentor and his route
to the bathroom is a major career booster."  -- Patrick Naughton


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/



More information about the Cygwin mailing list