Re: CASE error in script file

2006-11-09 Thread Jim Easton
Hi Eric, 08 Nov 2006 Eric Blake wrote: ... Consider upgrading - we're at cygwin 1.5.21 and bash 3.1 (or experimentally, 3.2). This list does not make it a habit to support older than the previous release, because of the bugs that have been fixed since. Is there a bash variable that

CASE error in script file

2006-11-08 Thread Doug
Hello, I am using Cygwin 1.5.21(0.156/4/2).I try to run the shell script called test.sh case $1 in 1) echo '1' ;; 2) echo '2' ;; *) echo 'Dunno' exit 1 esac but i always get the following error '/test.sh: line 1: syntax error near

Re: CASE error in script file

2006-11-08 Thread Shankar Unni
Doug wrote: case $1 in If $1 is undefined (i.e. you pass in no arguments), this line becomes case in which is incorrect syntax, of course. Answer: quote the $1. -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html

Re: CASE error in script file

2006-11-08 Thread Doug
Shankar Unni shankarunni at netscape.net writes: Doug wrote: case $1 in If $1 is undefined (i.e. you pass in no arguments), this line becomes case in which is incorrect syntax, of course. Answer: quote the $1. I did put the $1 in and it still gives me the same error

Re: CASE error in script file

2006-11-08 Thread DePriest, Jason R.
On 11/8/06, Doug wrote: Hello, I am using Cygwin 1.5.21(0.156/4/2).I try to run the shell script called test.sh but i always get the following error '/test.sh: line 1: syntax error near unexpected token `in '/test.sh: line 1: `case $1 in I am using Cygwin 1.5.21(0.156/4/2), too! I just

Re: CASE error in script file

2006-11-08 Thread Shankar Unni
Doug wrote: I did put the $1 in and it still gives me the same error case $1 in '/test.sh: line 1: syntax error near unexpected token `in '/test.sh: line 1: `case $1 in Do you have a DOS CR in there? (shows up as ^M in vim?) See the many, many threads in here about bash handling of CRs.

Re: CASE error in script file

2006-11-08 Thread Doug
DePriest, Jason R. jrdepriest at gmail.com writes: I am too lazy to search the (recent) archives about the bash controversy surrounding line endings, but that is your problem. Run d2u on your script, and it should work fine. Also, what editor did you use to create the script? If it was

Re: CASE error in script file

2006-11-08 Thread Eric Blake
Shankar Unni shankarunni at netscape.net writes: Doug wrote: case $1 in If $1 is undefined (i.e. you pass in no arguments), this line becomes case in which is incorrect syntax, of course. Answer: quote the $1. Quit spreading misinformation. POSIX requires that token parsing

Re: CASE error in script file

2006-11-08 Thread Jim Easton
Hi, 8 Nov 2006 21:57:40 Doug wrote: I am using Cygwin 1.5.21(0.156/4/2) case $1 in 1) echo '1' ;; 2) echo '2' ;; *) echo 'Dunno' exit 1 esac ... '/test.sh: line 1: syntax error near unexpected token `in '/test.sh: line 1:

Re: CASE error in script file

2006-11-08 Thread Eric Blake
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 According to Jim Easton on 11/8/2006 7:47 PM: Interesting: When I do that it works fine in both cases, even when I force a CR at the end of the line. It appears as though when bash sees the CR at the end of line it automatically deletes it. Mind

Re: CASE error in script file

2006-11-08 Thread Larry Hall (Cygwin)
On 11/08/2006, Doug wrote: I can run the script successfully in a linux box. It wouldn't run in it's current form on a Linux machine. Bash on Linux wouldn't understand DOS text files either. You'd see the same complaints on Linux. -- Larry Hall

Re: CASE error in script file

2006-11-08 Thread Larry Hall (Cygwin)
On 11/08/2006, Doug wrote: No, I use gVim 7.0 to edit the file. Windows or Cygwin version? Either way though, gvim will write files in binary or text form. You need to tell it what you want though. -- Larry Hall http://www.rfk.com RFK Partners, Inc.