I have a bash script running bunch of stuff along with aws listobject command. Recently we noted that the std err would have an error code but the script does not exit with non zero code. I hoped that the set -e should handle any command failures but it doesnt seem to do the trick.
Script looks like this:
#!/bin/bash
set -e
# do stuff
aws s3api list-objects --bucket xyz --prefix xyx --output text --query >> files.txt
# do stuff
Error in Stderr :
An error occurred (SlowDown) when calling the ListObjects operation (reached max retries: 4): Please reduce your request rate.
Objective: I want the bash script to fail & exit when it encounters a problem with the aws cli commands. I can add an explicit check on ($? != 0) but wondering if there is better way to do this.