1 # $OpenBSD: sftp-batch.sh,v 1.4 2009/08/13 01:11:55 djm Exp $
2 # Placed in the Public Domain.
10 rm -rf ${COPY} ${COPY}.1 ${COPY}.2 ${COPY}.dd ${BATCH}.
*
12 cat << EOF > ${BATCH}.pass.1
16 -put ${COPY} ${COPY}.2
19 cat << EOF > ${BATCH}.pass.2
22 # That was a blank line
26 cat << EOF > ${BATCH}.fail.1
30 # The next command should fail
31 put ${COPY}.3 ${COPY}.4
34 cat << EOF > ${BATCH}.fail.2
35 # The next command should fail
39 verbose
"$tid: good commands"
40 ${SFTP} -b ${BATCH}.pass.1 -D ${SFTPSERVER} >/dev
/null
2>&1 \
41 || fail
"good commands failed"
43 verbose
"$tid: bad commands"
44 ${SFTP} -b ${BATCH}.fail.1 -D ${SFTPSERVER} >/dev
/null
2>&1 \
45 && fail
"bad commands succeeded"
47 verbose
"$tid: comments and blanks"
48 ${SFTP} -b ${BATCH}.pass.2 -D ${SFTPSERVER} >/dev
/null
2>&1 \
49 || fail
"comments & blanks failed"
51 verbose
"$tid: junk command"
52 ${SFTP} -b ${BATCH}.fail.2 -D ${SFTPSERVER} >/dev
/null
2>&1 \
53 && fail
"junk command succeeded"
55 rm -rf ${COPY} ${COPY}.1 ${COPY}.2 ${COPY}.dd ${BATCH}.
*