I need the return code of the command that is executed over a remote ssh.
result=$(ssh $TARGET_USER@$TARGET_SERVER \
'cp /tmp/test1.txt \
/tmp1/test2.txt')
when the above command is unsuccessful
I want to perform some alerting action.
But the output of the result variable seems to be always null
any ideas how do i make use of the result variable
When i execute the above command i get this
cp: cannot create regular file ‘/tmp1/test2.txt’: No such file or directory