diff --git a/builtin.cpp b/builtin.cpp index fa6ce1eee..e5e6f86f5 100644 --- a/builtin.cpp +++ b/builtin.cpp @@ -1633,7 +1633,7 @@ static int builtin_echo( parser_t &parser, wchar_t **argv ) } } } - if (print_newline) + if (print_newline && continue_output) stdout_buffer.push_back('\n'); return STATUS_BUILTIN_OK; } diff --git a/tests/test1.in b/tests/test1.in index a3ac131e2..4dd01db1a 100644 --- a/tests/test1.in +++ b/tests/test1.in @@ -83,7 +83,8 @@ echo -e 'abc\41def' echo -e 'abc\041def' echo -e 'abc\121def' echo -e 'abc\1212def' -echo -e 'abc\cdef' +echo -e 'abc\cdef' # won't output a newline! +echo '' echo -e Catch your breath