Skip to content
This repository has been archived by the owner on Oct 24, 2024. It is now read-only.

Commit

Permalink
Improved algorithm
Browse files Browse the repository at this point in the history
  • Loading branch information
krikkrob committed Oct 12, 2023
1 parent 5bd30fc commit f555a71
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -116,13 +116,17 @@ main() {

# Iterate over $INPUT_SOURCE multiline string and run aws s3 $COMMAND
while IFS= read -r source; do
if [ "$COMMAND" == "cp" ] || [ "$COMMAND" == "mv" ] || [ "$COMMAND" == "sync" ]
then
echo "aws s3 $COMMAND \"$source\" $INPUT_DESTINATION $INPUT_FLAGS"
aws s3 "$COMMAND" "$source" "$INPUT_DESTINATION" "$INPUT_FLAGS"
if [ -n "$source" ]; then
if [ "$COMMAND" == "cp" ] || [ "$COMMAND" == "mv" ] || [ "$COMMAND" == "sync" ]
then
echo "aws s3 $COMMAND \"$source\" $INPUT_DESTINATION $INPUT_FLAGS"
aws s3 "$COMMAND" "$source" "$INPUT_DESTINATION" "$INPUT_FLAGS"
else
echo "aws s3 $COMMAND \"$source\" $INPUT_FLAGS"
aws s3 "$COMMAND" "$source" "$INPUT_FLAGS"
fi
else
echo "aws s3 $COMMAND \"$source\" $INPUT_FLAGS"
aws s3 "$COMMAND" "$source" "$INPUT_FLAGS"
echo "Source is empty, skipping AWS S3 command."
fi
done <<< "$INPUT_SOURCE"
}
Expand Down

0 comments on commit f555a71

Please sign in to comment.