This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Bash file not running correctly


On Sun, Feb 1, 2009 at 5:12 PM, Gulshan Singh wrote:

Ugh.  http://www.cygwin.com/acronyms/#PCYMTWLL

Reformatted.

> Hi, I just joined this mailing list and I'm not sure if it's the right
> place to post questions. If it's not, please direct me to the correct
> place. I'm having a weird problem when running a bash script. Lets say
> I make a script called list.sh. I open it in notepad and type ls. Then
                                               ^^^^^^^
> I go to the Cygwin bash shell and type ./list.sh. The list command
> works fine. Now let's say the file looked like this
>
> ls
> #This will list the files in the directory
>
> When I run this, the Cygwin shell will say "list.sh: line 1: $'ls\r':
> command not found". I think the \r has to do with a new line when
> I push enter. So basically I can't run anything longer than one line.
> Anyone know how to fix this?

Right.  Notepad ends lines with \r\n, bash wants files with \n line
endings.  Either save your files with an editor that can save with
unix-style \n line endings, or run the script through dos2unix before
trying to execute it.

~Matt

--
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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]