From: Charles McGarvey Date: Tue, 5 Jan 2010 04:12:49 +0000 (-0700) Subject: new tool for converting unix to dos file format X-Git-Url: https://git.dogcows.com/gitweb?p=chaz%2Fyoink;a=commitdiff_plain;h=246d7d6e4386b686327163d621c7c8b398b7d479 new tool for converting unix to dos file format --- diff --git a/tools/unix2dos b/tools/unix2dos new file mode 100755 index 0000000..31fa7c6 --- /dev/null +++ b/tools/unix2dos @@ -0,0 +1,22 @@ +#!/bin/sh + +# An implementation of unix2dos using sed. +# Written by Charles McGarvey; released into the public domain. + +if [ -f "$1" ]; +then + TMPFILE="$1.$$" + sed 's/\r*$/\r/' "$1" >$TMPFILE + if [ ! "$2" ]; + then + cp -f "$TMPFILE" "$1" + else + cp -f "$TMPFILE" "$2" + fi + rm -f "$TMPFILE" +else + echo "`basename $0` infile [outfile]" + echo " convert a file from unix to dos file format" + exit 1 +fi +