| # $OpenBSD: sftp-batch.sh,v 1.5 2013/05/17 04:29:14 dtucker Exp $ |
| # Placed in the Public Domain. |
| rm -rf ${COPY} ${COPY}.1 ${COPY}.2 ${COPY}.dd ${BATCH}.* |
| cat << EOF > ${BATCH}.pass.1 |
| cat << EOF > ${BATCH}.pass.2 |
| cat << EOF > ${BATCH}.fail.1 |
| # The next command should fail |
| cat << EOF > ${BATCH}.fail.2 |
| # The next command should fail |
| verbose "$tid: good commands" |
| ${SFTP} -b ${BATCH}.pass.1 -D ${SFTPSERVER} >/dev/null 2>&1 \ |
| || fail "good commands failed" |
| verbose "$tid: bad commands" |
| ${SFTP} -b ${BATCH}.fail.1 -D ${SFTPSERVER} >/dev/null 2>&1 \ |
| && fail "bad commands succeeded" |
| verbose "$tid: comments and blanks" |
| ${SFTP} -b ${BATCH}.pass.2 -D ${SFTPSERVER} >/dev/null 2>&1 \ |
| || fail "comments & blanks failed" |
| verbose "$tid: junk command" |
| ${SFTP} -b ${BATCH}.fail.2 -D ${SFTPSERVER} >/dev/null 2>&1 \ |
| && fail "junk command succeeded" |
| rm -rf ${COPY} ${COPY}.1 ${COPY}.2 ${COPY}.dd ${BATCH}.* |