Cygwin - Buggy?


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Cygwin - Buggy?
# 1  
Old 11-12-2007
Cygwin - Buggy?

Hello,
I am writing a bash script and it seems I can't get a simple conditional loop to work. Can someone please let me know why this does not work?

#!/bin/sh
echo " "
echo "Searching other files..."
#grep -l $0 testOutput_works.txt
for x in `cat acct.txt` ; do
echo $x
done

The acct.txt is just a simple file containing:
1
2
3
4
5

This is the error message I get:

Searching other files...
searchOtherFiles.sh: line 5: syntax error near unexpected token `$'do\r''
'earchOtherFiles.sh: line 5: `for x in `cat acct.txt` ; do

Is this an issue with Cygwin or the script? I can't get this script to run successfully. I have the latest version of Cygwin.

Thanks in advance for everyone's help!
-SSims
# 2  
Old 11-12-2007
Works fine for me. Looks like you may have some hidden character in the file.
Do a hex or octal dump of the file to see if this is the case.
# 3  
Old 11-12-2007
Quote:
Originally Posted by SSims
\r
Seeing as you are using cygwin, are you using files which have CR/LF line terminators instead of the UNIX standard of LF?

If you open the file using notepad.exe and the file looks "right" then the file has CR/LF not LF.
# 4  
Old 11-12-2007
Oh wow, I was using TextPad. Is there a Windows Editor I can use instead? I'm not ready to start learning an editor.

Thanks for the feedback!
# 5  
Old 11-12-2007
A tool called dos2unix (or dos2ux) may be available for you to use to convert DOS newlines to UNIX (ie. strip off the extra \r).
# 6  
Old 11-12-2007
dos2unix will works great! Thanks prowla.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

cygwin

Do clear command do not work in cygwin.. (4 Replies)
Discussion started by: parthmittal2007
4 Replies

2. Shell Programming and Scripting

opening new instance of cygwin from withing cygwin

I'm using cygwin on win7, What I would like to do is something like this: cygstart cygwin tail -f /foo/test.log | perl -pe 's/error/\e I know I can start a new instance using either of these: mintty -e ... cygstart tail ... But neither of those open in ANSI mode, so I can't do... (0 Replies)
Discussion started by: Validatorian
0 Replies

3. UNIX for Dummies Questions & Answers

Anyone else use Cygwin?

I started to gather some stats from our windows servers through the use of cygwin and sshd :) is anyone else doing this sort of thing? interested in some other indicators I should be checking for... thanks, manny the following is only an example of the type of data I am able to... (4 Replies)
Discussion started by: mr_manny
4 Replies

4. UNIX for Dummies Questions & Answers

cygwin

hi.... i want to set an alias to "ls -lart" permanently. i am using cygwin and in that .bashrc and .bash_profile files are readonly. so please tell me how i can do that? thanks (1 Reply)
Discussion started by: Usha Shastri
1 Replies

5. Web Development

Apache mod status buggy?

My problem is whenever I run mod status to capture the amount of byte count served I am getting 100+ gig of byte count! in 10 minutes! But when I try to filter the apache log and count the byte count served in the same time stamp within 12 hours, it computes to less than 103 MB only Just an... (0 Replies)
Discussion started by: 3rr0r_3rr0r
0 Replies

6. Linux

cygwin

I'm trying to run the make command in cygwin. The directory is d:\resiprocate-1.2.3\resip\dum\test. But the command outputs: cant open perl script "c:\Program": No such file or directory why??...check the attached JPEG file....plz help (10 Replies)
Discussion started by: m_well
10 Replies

7. UNIX for Dummies Questions & Answers

Cygwin X

I have managed a successful install of Cygwin (after a few tries), and like any sensible person am ignoring the console in favour of the xconsole. I have this set up how I want - tcsh, all hot-keys (including ^z for suspend) and et cetera, but find it awfully slow. Are there any good... (7 Replies)
Discussion started by: fulgura
7 Replies

8. UNIX for Dummies Questions & Answers

Cygwin

Hi , I have software CYGWIN . Can i practice for shell script on that? Thanks sam71 (1 Reply)
Discussion started by: sam71
1 Replies

9. UNIX for Dummies Questions & Answers

about cygwin

hi everyone. i have a problem on installing binary file in my cygwin. could anyone help me wat command should i use to install it ? thanks a lot (4 Replies)
Discussion started by: wins1982
4 Replies
Login or Register to Ask a Question