Skip to content

Commit c29bcb2

Browse files
committed
echo: don't output "\n" if "\c" is encountered
1 parent 139f205 commit c29bcb2

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/uu/echo/src/echo.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ fn execute(no_newline: bool, escaped: bool, free: &[String]) -> io::Result<()> {
175175
}
176176
if escaped {
177177
if print_escaped(input, &mut output)?.is_break() {
178-
break;
178+
return Ok(());
179179
}
180180
} else {
181181
write!(output, "{input}")?;

tests/by-util/test_echo.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ fn test_escape_no_further_output() {
122122
new_ucmd!()
123123
.args(&["-e", "a\\cb", "c"])
124124
.succeeds()
125-
.stdout_only("a\n");
125+
.stdout_only("a");
126126
}
127127

128128
#[test]

0 commit comments

Comments
 (0)