From bec783cf2a9e54a001c00280b8311a2c9ea8ce5e Mon Sep 17 00:00:00 2001 From: Matthew Batchelder Date: Tue, 16 Feb 2021 21:33:33 -0500 Subject: [PATCH] Output the command being executed --- commands/exists.sh | 6 +++++- commands/ls.sh | 6 ++++-- commands/rm.sh | 6 +++++- commands/sync.sh | 6 +++++- 4 files changed, 19 insertions(+), 5 deletions(-) diff --git a/commands/exists.sh b/commands/exists.sh index 47da7d4..d4ccc4d 100755 --- a/commands/exists.sh +++ b/commands/exists.sh @@ -9,8 +9,12 @@ fi echo "Checking for file existence at s3://${S3_BUCKET}/${FILE} at the ${S3_ENDPOINT}" +the_command="aws s3api head-object --bucket ${S3_BUCKET} --key ${FILE} ${S3_PROFILE} ${ENDPOINT_APPEND} $*" + +echo $the_command + # Verify file existence. -sh -c "aws s3api head-object --bucket ${S3_BUCKET} --key ${FILE} ${S3_PROFILE} ${ENDPOINT_APPEND} $*" +sh -c $the_command # XXX: we are just checking the error code, but should check the result for a 404, and raise error in other cases if [ $? == 0 ] diff --git a/commands/ls.sh b/commands/ls.sh index bc06a97..8936184 100755 --- a/commands/ls.sh +++ b/commands/ls.sh @@ -7,10 +7,12 @@ if [ -z "$FILE" ]; then exit 1 fi -echo $ENDPOINT_APPEND +the_command="aws s3 ls s3://${S3_BUCKET}/${FILE} ${S3_PROFILE} ${ENDPOINT_APPEND} $*" + +echo $the_command # Verify file existence. -output=$(sh -c "aws s3 ls s3://${S3_BUCKET}/${FILE} ${S3_PROFILE} ${ENDPOINT_APPEND} $*") +output=$(sh -c $the_command) echo $output diff --git a/commands/rm.sh b/commands/rm.sh index ea718d3..d4ee2cd 100755 --- a/commands/rm.sh +++ b/commands/rm.sh @@ -7,8 +7,12 @@ if [ -z "$FILE" ]; then exit 1 fi +the_command="aws s3 rm s3://${S3_BUCKET}/${FILE} ${S3_PROFILE} ${ENDPOINT_APPEND} $*" + +echo $the_command + # Verify file existence. -output=$(sh -c "aws s3 rm s3://${S3_BUCKET}/${FILE} ${S3_PROFILE} ${ENDPOINT_APPEND} $*") +output=$(sh -c $the_command) echo $output diff --git a/commands/sync.sh b/commands/sync.sh index a63c007..346dce6 100755 --- a/commands/sync.sh +++ b/commands/sync.sh @@ -2,5 +2,9 @@ set -e +the_command="aws s3 sync ${SOURCE_DIR:-.} s3://${S3_BUCKET}/${DEST_DIR} ${S3_PROFILE} --no-progress ${ENDPOINT_APPEND} $*" + +echo $the_command + # Sync path. -sh -c "aws s3 sync ${SOURCE_DIR:-.} s3://${S3_BUCKET}/${DEST_DIR} ${S3_PROFILE} --no-progress ${ENDPOINT_APPEND} $*" +sh -c $the_command