export: set correct exit status

This commit is contained in:
Khaïs COLIN 2025-04-01 15:58:34 +02:00
parent 3cdf7c3f76
commit ba4192bf8d
Signed by: logistic-bot
SSH key fingerprint: SHA256:RlpiqKeXpcPFZZ4y9Ou4xi2M8OhRJovIwDlbCaMsuAo
2 changed files with 9 additions and 1 deletions

View file

@ -307,25 +307,31 @@ EXTRAENV=-i
when_run <<EOF "export with strange inputs"
export PATH=$PATH
export var
echo status=\$?
echo var=[\$var]
export blue=
echo status=\$?
echo blue=[\$blue]
env -u PATH env
EOF
expecting <<EOF
status=0
var=[]
status=0
blue=[]
blue=
EOF
when_run <<"EOF" "export with invalid identifiers"
export = 123=456 hello=hi 456=789
echo status=$?
echo hello=$hello
EOF
expecting <<"EOF"
minishell: export: `=': not a valid identifier
minishell: export: `123=456': not a valid identifier
minishell: export: `456=789': not a valid identifier
status=1
hello=hi
EOF