is it possible to get the standard output from remote machine - 100 or 1 , After ruining the script /tmp/script.bash ?
ssh $remote_machine /tmp/script.bash
echo $? ( from remote machine script - not from ssh ! )
on remote machine -
more /tmp/script.badsh
#!/bin/bash
command
[[ $? -eq 0 ]] && exit 100 || exit 1
It seems that you want the exit value from the remote script (
$?
) and not stdout (the scripts output as per your title)The ssh man page says this
So if your script is working correctly it will return 100. If it's not then there are a few possibilities
command
is not exiting with 0[[ ... ]]
is incorrect which looks right, I think that- eq
should be-eq
1.1OP has edited their question and removed the obvious error from point 2 above. We are left to conclude that point 1 is correct.