Bash on CygWin


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Bash on CygWin
# 1  
Old 06-23-2015
Bash on CygWin

I am using CygWin to run a bash file but I am getting weird results.

Code:
#!/bin/bash
mkdir CLEANDATA
mv *FASTA CLEANDATA
cd CLEANDATA
ls
echo "COMPLETE"

And this is what I get
Code:
$ ./Pipe.txt
./Pipe.txt: line 5: $'ls\r': command not found
COMPLETE

Moreover, the new folder is named CLEANDATA* instead of CLEANDATA.
Any help will be very much appreciated
# 2  
Old 06-23-2015
You edited the command script with a windows editor. Bad. UNIX uses \n for carriage control, windows uses \r\n. File with \r\n break command scripts as you now see.

Run the script file through the dos2unix command:
Code:
dos2unix script.shl script.shl  
chmod +x script.shl

This User Gave Thanks to jim mcnamara For This Post:
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Using BATCH to call a BASH script on CygWin

I am trying to use a batch file to automatically execute a bash script with no luck this far. The batch script looks like this: C:\Cygwin64\bin\bash test.sh I have also tried this: C:\Cygwin64\bin\bash "C:\Cygwin64\bin\test.sh" Needless to say that the windows box has Cygwin... (7 Replies)
Discussion started by: Xterra
7 Replies

2. Shell Programming and Scripting

Bash Script (tar + md) on Cygwin

Hi everybody, First, I'm sorry for my bad english! I have the following situation: I have a Windows 2012 R2 with Cygwin installed. The Windows Server is used as a backup Server with Dell AppAssure installed. At the moment, AppAssure saves Backup Targets to a repository on his D. The... (9 Replies)
Discussion started by: fibra3000
9 Replies

3. Shell Programming and Scripting

Help with bash scripting in cygwin

Hi, I am trying to write a bash script, to open firefox and then open a local webpage in a tab. This is a shell of what I have #! /bin/sh alias firefox='/cygdrive/c/Program\ Files/Mozilla\ Firefox/firefox.exe' $URL='/cygdrive/d/Playback.html' firefox & sleep 1 for i in 1 2 3 4 5 #6 7 8 9... (1 Reply)
Discussion started by: jamie_123
1 Replies

4. Shell Programming and Scripting

Cygwin bash script to unmount and mount an XP partition

As stated, I am looking into keeping my backup drive unmounted in normal windows use. Partly this is to address threats like cryptolocker. Since one of my backup drives is an internal drive, it will not likely afford any protection from such a threat. I am thinking of adding code to my rsync script... (5 Replies)
Discussion started by: LMHmedchem
5 Replies

5. Shell Programming and Scripting

How to start powershell with shebang from windows/cygwin/bash?

I would like to the the windws8/cygwin/bash shebang feature to start a powershell script. I do a "chmod +x set-sound.ps1" and then at a bash prompt I do ./set-sound.ps1 The first line of ./set-sound.ps1 #!powershell.exe -ExecutionPolicy unrestricted The result is the result: ... (5 Replies)
Discussion started by: siegfried
5 Replies

6. Windows & DOS: Issues & Discussions

run cygwin bash script from notepad++

I'm using Notepad++ to edit my BASH scripts and using CYGWIN to run them from Windows7. In Notepad++ there is a 'Run' capability. How do I get this to run my scripts directly without having to enter the script name from the Cygwin command line? (3 Replies)
Discussion started by: millsy5
3 Replies

7. Shell Programming and Scripting

Strange suppression of output with bash and cygwin

Hi, although I am not expert in bash, so please forgive me if this is silly, I think that this is strange: I have this command: find . -type f -print0 |xargs -0 grep -i -e 'some rexp' and it works fine. But when I create a bash script (on cygwin) to run this command, there is no output !!!... (3 Replies)
Discussion started by: Niki999
3 Replies

8. Shell Programming and Scripting

bash command in makefile (cygwin)

Hello, In my make file (make 3.81), I use a combination of shell commands to automatically create the name of my build directory. OS := $(shell uname -s) ARCH := $(shell uname -m) KERN := $(shell uname -r | cut -d. -f 1,2) BDIR := $(OS)_$(KERN).$(ARCH)When I boot into different OSs, I... (7 Replies)
Discussion started by: LMHmedchem
7 Replies

9. UNIX for Dummies Questions & Answers

Cygwin bash script and read command

Hello everyone, I am struggling a bit with a batch script that I need to run in cygwin. I work in winXP and I had to write some awk scripts to do some file manipulation, and now I would like to automate the process by just running a batch file so that my colleagues can use it easily. Now, the... (2 Replies)
Discussion started by: Teroc
2 Replies

10. UNIX for Dummies Questions & Answers

How to use cygwin to run bash script

Hi, all, I try to run a quite simple bash script mytest.sh in cygwin, it's content is: #!/bin/bash echo "It is my first bash shell" there are three lines in the script. The second line is blank line. When I run it use command: bash c:/mytest.sh, ... (6 Replies)
Discussion started by: Jenny.palmy
6 Replies
Login or Register to Ask a Question