how to get status array for the commands in eval

I want to get a status code array for the commands in eval.

For example,
eval "ls abc; ls def; ls $HOME"

I want to get the status code for each ls command in eval. Is there any way to make it?

Thanks.

I am not sure why you would want to do this. This is hard to read and not maintainable. Why are you using eval in this case?

What exactly are you trying to accomplish and why does it have to be on one line?

The command list string is inputed by the user, and the script is supposed to run it.
Anyway, I found a workaround by running each command separately:

command="ls abc; ls $HOME"

while read cmd
    do
        cmd="sudo $cmd"
        $cmd
        if [[ x"$\{PIPESTATUS[0]\}" != x"0" ]]
        then
            exit_code=$\{PIPESTATUS[0]\}
        fi
    done << HERE

$(echo $command | awk -F';' '{for(i=1;i<=NF;i++) print $i}')
HERE
exit $exit_code

But I met a different problem when the user doesn't have a sudo privilege. I have to use su:

command="ls abc; ls $HOME"
su - -c "$command" 

In this case, is there anyway I can get status code for each ls command in $command? Since su - -c "$command" will ask for root password, and I don't want the user to input the password twice.