Python : Using Pexpect : ftpTestOffload.sh

Some operations are easily handled in bash, like cleanup functions. And bash can call a main Python routine.

#!/bin/bash
# Author: Armando S. Romero III

# Runs ftpTest.py to do pexpect session, 
# checks if the file downloaded successfully, 
# cleans up when done

cleanup(){
rm -f -- InRelease
}

ftpTest.py

if [[ -r InRelease ]] ;then
echo "Transfer succeeded"
cleanup
exit 0
fi
echo "Failed to transfer"
cleanup
exit 10

See the next post for the Python script this calls.