That won't work because sshd runs the command using the user's login shell. From https://man.openbsd.org/sshd#LOGIN_PROCESS:
> When a user successfully logs in, sshd does the following:
> ...
> 9. Runs user's shell or command. All commands are run under the user's login shell as specified in the system password database.