Deleting a file with LFTP using variables
That's because you are using simple quote instead of double quotes.
Change this and will work
USERNAME="theuser"PASSWORD="verygoodpassword"SERVER="example.com"BACKUPDIR="thebackups"FILETODELETE="uselessfile.obsolete"lftp -e "rm /${BACKUPDIR}/${FILETODELETE}; bye" -u $USERNAME,$PASSWORD $SERVER