Skip to main content
edited tags
Link
Gilles 'SO- stop being evil'
  • 866.2k
  • 205
  • 1.8k
  • 2.3k
added ssh tag
Source Link
Raphael Ahrens
  • 9.9k
  • 5
  • 39
  • 53

My script contains ana 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.

My script contains an 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.

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.

My script contains the sshan 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 successfuly in case ofsuccessfully 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.

My script contains the ssh command to login to remote server and execute 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 successfuly in case of 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.

My script contains an 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.

improved formatting
Source Link
harish.venkat
  • 8k
  • 3
  • 27
  • 30
Loading
Source Link
Loading