Strange suppression of output with bash and cygwin


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Strange suppression of output with bash and cygwin
# 1  
Old 09-28-2011
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:
Code:
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 !!! This is the content of the script:
Code:
#!/usr/bin/bash -x
find . -type f -print0 |xargs -0 grep -i -e 'some rexp'

Notice the -x in the shebang. I get the command at the standard output, but the output of grep is suppressed!

Can somebody give me any advice?
Thanks
# 2  
Old 09-28-2011
Quote:
Originally Posted by Niki999
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:
Code:
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 !!! This is the content of the script:
Code:
#!/usr/bin/bash -x
find . -type f -print0 |xargs -0 grep -i -e 'some rexp'

Notice the -x in the shebang. I get the command at the standard output, but the output of grep is suppressed!

Can somebody give me any advice?
Thanks
what is full output after process your cmmand?

add..
if you edit script in windows then you must use for delete CR and then try again..
Code:
dos2unix.exe yourscript


Last edited by ygemici; 09-28-2011 at 10:43 AM..
This User Gave Thanks to ygemici For This Post:
# 3  
Old 09-28-2011
ygemici I love you ! the problem was the line terminators..
# 4  
Old 09-28-2011
Quote:
Originally Posted by Niki999
ygemici I love you ! the problem was the line terminators..
Smilie
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

Ubuntu 16 Bash strange output

Hello, I work in Ubuntu 16.04, I am new to Bash and something is wrong with my script, please help. I have a few hundreds of subjects data (like subj003.nii.gz, subj012.nii.gz etc. up to subj567.nii.gz) in a directory /usr/afewmoredirectories/subjects. I may run for each subject a command... (5 Replies)
Discussion started by: lim-lim
5 Replies

3. 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

4. UNIX for Dummies Questions & Answers

Bash on CygWin

I am using CygWin to run a bash file but I am getting weird results. #!/bin/bash mkdir CLEANDATA mv *FASTA CLEANDATA cd CLEANDATA ls echo "COMPLETE" And this is what I get $ ./Pipe.txt ./Pipe.txt: line 5: $'ls\r': command not found COMPLETE Moreover, the new folder is... (1 Reply)
Discussion started by: Xterra
1 Replies

5. 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

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

redirect time command output to file (cygwin bash)

I have set up a bash script to run a long list of things that I need to time. I would like to redirect the output of time to a file. I have set it up like, echo "Runtimes for servlet 4, 100K structures" > test_times.txt echo "" >> test_times.txt echo "runs where N=10" >> test_times.txt echo... (7 Replies)
Discussion started by: LMHmedchem
7 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. Windows & DOS: Issues & Discussions

Output of ls command on Cygwin

what does the '+' sign stand for on the output of ls command on cygwin? -rw-------+ 1 milhan None 146783 Jun 19 12:10 schedule.pdf -rw-------+ 1 milhan None 320 Aug 15 17:14 current.txt -rw------- 1 milhan None 24576 Dec 28 2008 fdfd.txt (2 Replies)
Discussion started by: milhan
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