When I execute a command as below it gives me an output as expected but when I run the same command on remote server it always gives me echo $?
as 0
.
locally
# <some command>
# echo $?
Remotely
# ssh server " <some command >; echo $? "
Now in case of remote execution I always get 0
as echo $?
output.