I'm creating a Bash script file on iOS X that asks the user if they would like to upload a file to a server. The sftp command (with a delimiter) works fine outside the if statement but when I put the sftp command (with the delimiter) inside the if statement, I get this error message: "upload.sh: line nnn: syntax error: unexpected end of file"
printf "Upload file? [y]es?"
read -r input1
if [ $input1 == "y" ] || [ $input1 == "yes" ]; then
sftp -i key.txt user@server << DELIMITER
put local/path/to/file /server/upload/dir
quit
DELIMITER
fi
What am I missing here?