diff --git a/src/subst/variable_subst.c b/src/subst/variable_subst.c index 9415519..96f903f 100644 --- a/src/subst/variable_subst.c +++ b/src/subst/variable_subst.c @@ -5,8 +5,8 @@ /* +:+ +:+ +:+ */ /* By: khais +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ -/* Created: 2025/03/19 17:28/29 by khais #+# #+# */ -/* Updated: 2025/03/24 10:52:10 by jguelen ### ########.fr */ +/* Created: 2025/03/19 17:28:29 by khais #+# #+# */ +/* Updated: 2025/04/16 17:45:36 by khais ### ########.fr */ /* */ /* ************************************************************************** */ @@ -95,9 +95,9 @@ static char *calculate_replacement(t_worddesc *word, t_minishell *app, size_t i, { *id_len = 1; rep = expand_question_mark(app); - if (!rep) - return (NULL); } + else if (*id_len == 0) + return (free(id), ft_strdup("$")); else { rep = env_get_val(app->env, id); diff --git a/test.sh b/test.sh index dbf2a1c..09202fe 100755 --- a/test.sh +++ b/test.sh @@ -658,4 +658,20 @@ expecting <