diff --git a/src/executing/simple_cmd/builtin_echo.c b/src/executing/simple_cmd/builtin_echo.c index 574b1d3..013a165 100644 --- a/src/executing/simple_cmd/builtin_echo.c +++ b/src/executing/simple_cmd/builtin_echo.c @@ -6,7 +6,7 @@ /* By: khais +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2025/04/03 13:59:13 by khais #+# #+# */ -/* Updated: 2025/04/03 14:11:57 by khais ### ########.fr */ +/* Updated: 2025/04/03 17:18:54 by khais ### ########.fr */ /* */ /* ************************************************************************** */ @@ -26,7 +26,9 @@ static bool should_print_newline(t_wordlist **arg) if ((*arg)->word->word[0] != '-') break ; i = 1; - end_of_args = false; + end_of_args = (*arg)->word->word[i] == '\0'; + if (end_of_args) + break ; while ((*arg)->word->word[i] != '\0' && !end_of_args) { if ((*arg)->word->word[i++] != 'n') diff --git a/test.sh b/test.sh index 8d611b5..e777714 100755 --- a/test.sh +++ b/test.sh @@ -452,6 +452,13 @@ hi -n hello goodbye EOF +when_run <