Matthew Woehlke wrote:
Rob Walker wrote:
Christopher Faylor wrote:
On Thu, Oct 12, 2006 at 03:17:02PM +0300, Antti Tyrv?inen wrote:
Hi!
Installed latest cygwin and I met problems with bash and scripts
which are in DOS format.
$ bash --version
GNU bash, version 3.1.17(9)-release (i686-pc-cygwin)
Copyright (C) 2005 Free Software Foundation, Inc.
I read the mailing lists and I also tried to add ' shopt -s
igncr;#' in the beginning of the script, but it didn't work. In my
opinion, this is bad solution if I have to edit all my existing
scripts.
All works fine with bash 3.1.6.
What I should do?
a) install bash 3.1.6 and wait for new
b) install bash 3.1.9. and convert all my scripts to UNIX format
b), i.e., use the tool the way it was designed to be used.
Saying cygwin's bash wasn't designed to handle CRLF is a lot like
saying that cygwin's bash (as previously released all these years)
wasn't designed to work with the rest of Windows. This might
actually be the case, but I don't understand the point. If you don't
want to work with Windows, why release for Windows?
Many, many other cross-platform products make allowances for CRLF
(version control systems are a prime example) to maximize
compatibility, and thereby their usefulness, on Windows. Cygwin's
recent changes (with make and bash) here has put a real crimp in my
plans to depend on cygwin for a portable build environment.
Just curious, is there a goal or strategy that drives changes like this?
Speed?
I was actually asking a larger question. There's obviously value in
handling CRLF invisibly, and value in having speed. When evaluating
which is _more_ valuable, what are the inputs?
But seriously, dude. If handling CRLF starts to approach in complexity
what the rest of bash does, CRLF handling should probably be rewritten.
I think using 'igncr' should satisfy your complaints. If it doesn't,
you need to tell use WHY (which, you'll notice, the OP failed to do).
So far, igncr hasn't worked for me either. I think this is because I
don't know how to use it.
This is the simple shell script I'd like to have work (lines separated
by CRLF):
#!/bin/bash
echo helloworld
I have c:/tmp mounted at /tmp, where I put my test script (called
helloworld.sh):
[EMAIL PROTECTED]> pwd
/tmp
[EMAIL PROTECTED]> mount
C:\Documents and Settings on /home type system (binmode)
C:\apps\cygwin\bin on /usr/bin type system (binmode)
C:\apps\cygwin\lib on /usr/lib type system (binmode)
C:\apps\cygwin on / type system (binmode)
C:\tmp on /tmp type system (binmode)
A: on /a type system (binmode)
C: on /c type system (binmode)
D: on /d type system (binmode)
When I run this script, this is what I see (when run from the "Cygwin
Bash Shell" DOS box):
[EMAIL PROTECTED]> bash --version
GNU bash, version 3.1.17(9)-release (i686-pc-cygwin)
Copyright (C) 2005 Free Software Foundation, Inc.
[EMAIL PROTECTED]> ./helloworld.sh
hello world
: command not foundne 3:
I also tried this way:
[EMAIL PROTECTED]> bash -O igncr
[EMAIL PROTECTED]> ./helloworld.sh
hello world
: command not foundne 3:
I also tried editing the script (which I fear breaks it for non 3.x
users of bash):
#!/bin/bash -O igncr
echo helloworld
With this, I see:
[EMAIL PROTECTED]> ./helloworld.sh
/usr/bin/bash: - : invalid option
Usage: /usr/bin/bash [GNU long option] [option] ...
/usr/bin/bash [GNU long option] [option] script-file ...
GNU long options:
--debug
--debugger
--dump-po-strings
--dump-strings
--help
--init-file
--login
--noediting
--noprofile
--norc
--posix
--protected
--rcfile
--restricted
--verbose
--version
--wordexp
Shell options:
-irsD or -c command or -O shopt_option (invocation only)
-abefhkmnptuvxBCHP or -o option
What does work for me is:
[EMAIL PROTECTED]> bash -O igncr ./helloworld.sh
hello world
Of course, this doesn't help me for nested scripts that call each other
without using "bash".
-Rob
--
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/