This is the mail archive of the cygwin@sourceware.cygnus.com 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]

dos2unix shell script


Appended is a script I use to convert CRLF to CR on
selected files.  To use it, the files to be converted
must be on a

<<< _binary_ mount point >>>

_not_ a text mount point.

I use it this way:

bash$ find . -type f -name '[Mm]akefile*' | xargs dos2unix

which will convert makefiles residing on a binary mount
point, a common source of complaint on this list.

Cheers!


--- cut here ---
#! /bin/sh
if [ ! "$1" ] ; then
	echo `basename $0` file ...
	echo '  convert' filenames from dos to unix
	exit 1
fi

while [ "$1" ] ; do
	TMP=$1.$$
	if tr -d '\r' <"$1" >"$TMP" ; then
		cp -a -f "$TMP" "$1"
	fi
	rm -f "$TMP"
	shift
done

----------------------------
John Paulson
PowerTV, Inc.
Tel: 408/777-4769
Fax: 408/777-0176
mailto:paulson@powertv.com
http://www.powertv.com/


--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com


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