[Discuss] cygwin problem

pw p.willis at telus.net
Wed Apr 16 11:41:53 PDT 2008


Hello Noel,



The original script is slightly more complex.

IFS=$'\n'

export BACKUP_DIR=/cygdrive/some_dir/

#where drives.txt is a list of lower case drive letters

for DRIVE in  `cat /cygdrive/c/backup/drives.txt`;do
	cd /cygdrive/$DRIVE

	#where doc_types is a list of file specs ie: '*.doc'

	for DOC_TYPE in `cat /cygdrive/c/backup/doc_types.txt`; do
		for FIL in `find -iname '$DOC_TYPE'`; do
			#cp -dpR "$FIL" "$BACKUP_DIR"
			echo $FIL;
		done
	done
done

I haven't tried putting the full path into the find command though.

ie:

for FIL in `find /cygdrive/$DRIVE -iname '$DOC_TYPE'`; do

I'll try that.........Nope, no change.

The same script works fine in a linux box.
I'm thinking bash is broken on cygwin or it's overflowing memory
or something.

Peter


Noel Burton-Krahn wrote:
> what does this produce?
> 
>   find . -iname '*.doc'
> 
> Note the ".".  Your example didn't have a directory name before the iname
> 
> ~Noel
> 
> 
> On Wed, Apr 16, 2008 at 11:09 AM, pw <p.willis at telus.net> wrote:
>> Hello,
>>
>>  I have been trying to get a small bash script to work in
>>  cygwin but am having some problems.
>>
>>  If I use a find command in a loop on the command line
>>  it works fine:
>>
>>  ie:
>>
>>  /> for FIL in `find -iname '*.doc'`; do echo $FIL; done
>>
>>  (comes up with loads of files)
>>
>>
>>  If I put the same loop in a bash script:
>>
>>  ie:
>>
>>  for FIL in `find -iname '*.doc'`; do
>>         echo $FIL
>>  done
>>
>>  and then run 'sh script.sh' to test, find doesnt come up with any
>>  files...(!?)
>>
>>  Any ideas anyone?
>>
>>  Peter
>>  _______________________________________________
>>  Discuss mailing list
>>  Discuss at vlug.org
>>  http://ladybug.vlug.org/cgi-bin/mailman/listinfo/discuss
>>
> _______________________________________________
> Discuss mailing list
> Discuss at vlug.org
> http://ladybug.vlug.org/cgi-bin/mailman/listinfo/discuss
> 




More information about the Discuss mailing list