Here is my test.sh:
#!/usr/bin/env bash
echo succeed
When I direct run it, it output:
[jerry@Jerry-DELL ~]$ ./test.sh
succeed
However, when i run it through ssh:
[jerry@Jerry-DELL ~]$ ssh localhost /home/jerry/test.sh
/usr/bin/env: 'bash': No such file or directory
Then, when i change “/usr/bin/env bash” to “/bin/bash”, it works:
[jerry@Jerry-DELL ~]$ ssh localhost /home/jerry/test.sh
succeed
So, what’s the problem? How can i fix it? By the way, i use openssh8.6.