fix(builtin/export): show error on invalid identifiers such as % and $

This commit is contained in:
Khaïs COLIN 2025-04-18 10:11:12 +02:00
parent efaf4708f9
commit c5e15903e0
2 changed files with 27 additions and 9 deletions

15
test.sh
View file

@ -749,10 +749,25 @@ EOF
when_run <<EOF "export with empty arguments"
export "" ""
echo \$?
EOF
expecting <<"EOF"
minishell: export: `': not a valid identifier
minishell: export: `': not a valid identifier
1
EOF
when_run <<EOF "export with invalid identifiers"
export % $ 0 1 \$?
echo \$?
EOF
expecting <<"EOF"
minishell: export: `%': not a valid identifier
minishell: export: `$': not a valid identifier
minishell: export: `0': not a valid identifier
minishell: export: `1': not a valid identifier
minishell: export: `0': not a valid identifier
1
EOF
finalize