Question

I am running an SFTP batch to get a series of files from one unix server to another. I have a shell script that builds the batch files like:

cd path

get filename

cd path

get filename

and more.

Is there a way within SFTP to NOT run a get command if the preceding cd command fails, but keep running the rest of the batch?

To be clear, I do NOT want to terminate the whole SFTP batch, just the one get command if it's related cd command does not work.

No correct solution

OTHER TIPS

After each cd check error code, if it is 0, everything is fine. If not, some error occured in last command...

Like:

cd directory
if [!$?]
then
   get something
fi
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top