Juan-aga / Minishell

The Unlicense
2 stars 1 forks source link

Original echo -n is weird! #30

Closed emartinez-dev closed 1 year ago

emartinez-dev commented 1 year ago

Description

The -n flag can be interpreted in a lot of different ways and there are some border cases that I have been testing

How to reproduce

Execute echo with weird -n arg combinations

Result

minishell  Minishell $> echo -nn hola
-nn hola
minishell  Minishell $> echo -n -n -n hola
-n -n hola minishell  Minishell $> 

minishell  Minishell $> echo -n"-n" hola
-n hola minishell  Minishell $> echo "-nnnn" hola
-nnnn hola
minishell  Minishell $> 

Expected result

emartinez@Enrique-HP:~$ echo -nn hola
holaemartinez@Enrique-HP:~$ echo -n -n -n hola
holaemartinez@Enrique-HP:~$ 

emartinez@Enrique-HP:~$ echo -n"-n" hola
-n-n hola
emartinez@Enrique-HP:~$ echo "-nnnn" hola
holaemartinez@Enrique-HP:~$ 
Juan-aga commented 1 year ago

Fix it!