Fwd: CRLF
Chris Sutcliffe
ir0nh34d@gmail.com
Sat Dec 31 21:33:00 GMT 2011
Below please find the response from Thorsten (the mksh developer)
regarding CRLF.
Chris
---------- Forwarded message ----------
From: Thorsten Glaser
Date: 31 December 2011 15:00
Subject: Re: CRLF
To: miros-discuss@mirbsd.org
Chris Sutcliffe dixit:
>The mksh developer's preference is that mksh behave the same
>irregardless of platform
Yes. I’m even prepared to fight POSuX on some of the things
they mandate that would require different behaviour across
platforms, and, if necessary, be not compliant. This is a
feature, and really a big one, trust me.
Implicit CR stripping WILL break existing scripts. I know
of at least one.
>> Or you could use dos2unix...
>
>I think this would be the best course of action on this particular issue.
tr -d \\r would work, too (but also strip CR in the middle).
Quick hack (needs just a POSuX shell and no local builtin):
mkshdos_re=$(printf 's/\r$//')
mkshdos() {
if test -n "$1"; then
mkshdos_fn=$1
shift
else
mkshdos_fn=-
fi
mkshdos_T=$(mktemp /tmp/mkshdos.XXXXXXXXXX) || {
echo >&2 mkshdos: Error: Could not create temporary file.
return 255
}
sed "$mkshdos_re" <"$mkshdos_fn" >"$mkshdos_T"
mksh "$mkshdos_T" "$@"
mkshdos_rv=$?
rm -f "$mkshdos_T"
return $mkshdos_rv
}
Please forward this.
--
Chris Sutcliffe
http://emergedesktop.org
http://www.google.com/profiles/ir0nh34d
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
More information about the Cygwin
mailing list