My script contains a
ssh command to login to remote server and execute a few commands,
The command checks if a file exist and if not it should come out of the entire script.
ssh $user@$hostname "if[ -f $filename];then echo"file exists Proceeding next steps; else "echo file doesn't exist"; exit 1; fi"
However the above command gets executed successfully if the file present But in other case if file doesn't exist, the exit command just comes out of the ssh session
It still continues with other commands in the script rather exiting script.
Please help me with your suggestions.