[ANNOUNCEMENT] Updated: bash-4.3.42-3
Mikhail Usenko
cygwin@inbox.ru
Fri Sep 11 11:17:00 GMT 2015
On Tue, 25 Aug 2015 14:19:54 -0600
Eric Blake (cygwin) <...> wrote:
> A new release of bash, 4.3.42-3, has been uploaded and will soon reach a
> mirror near you; leaving 4.3.39-2 as the previous version.
>
It is one more buggy release (cygwin-specific).
---8<---(cygwin-test.sh)---8<---
#! /bin/bash
sender()
{
echo -n '\r\n' >&2
echo -ne '\r\n'
sleep 1
echo -n '\r\r\n' >&2
echo -ne '\r\r\n'
sleep 1
echo -n '\r\r\r\n' >&2
echo -ne '\r\r\r\n'
sleep 1
}
receiver()
{
t=""
while read t || [ "$t" ]; do
echo -n ": "
od -A n -t x1 <<<"$t"
done >&2
}
# implicit pipe
receiver < <(sender)
# explicit pipeline
sender | receiver
--->8---(cygwin-test.sh)--->8---
$ ./cygwin-test.sh
\r\n: 0a
\r\r\n: 0d 0d 0a
\r\r\r\n: 0d 0d 0a
\r\n: 0a
\r\r\n: 0d 0d 0a
\r\r\r\n: 0d 0d 0a
There is also the similar problem found accidentally just now with sed in pipelines:
$ echo -ne "\r\n" | sed '' | od -A n -tx1 # should be: 0d 0a
0a
$ echo -ne "\r\r\n" | sed '' | od -A n -tx1 # should be: 0d 0d 0a
0d 0a
On Thu, 04 Jun 2015 06:16:04 -0600
Eric Blake <...> wrote:
>
> 'echo -ne' is non-portable (I can break it with 'shopt -s xpg_echo');
> get used to using 'printf' instead.
>
xpg_echo doesn't change 'echo -ne' behavior
('echo -e' force backslash-escape sequences expansion independently)
$ shopt xpg_echo
xpg_echo off
$ echo -e '\r\n' | od -tx1
0000000 0d 0a 0a
0000003
$ shopt -s xpg_echo
$ shopt xpg_echo
xpg_echo on
$ echo -e '\r\n' | od -tx1
0000000 0d 0a 0a
0000003
$ echo '\r\n' | od -tx1
0000000 0d 0a 0a
0000003
--
Mike
--
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