Skip to content

Commit

Permalink
updated aws_foreach_profile.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
HariSekhon committed Nov 22, 2024
1 parent 46670f0 commit debd218
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions aws/aws_foreach_profile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,16 @@ help_usage "$@"

min_args 1 "$@"

aws configure list-profiles --output text |
profiles="$(aws configure list-profiles --output text)"

total_profiles="$(wc -l <<< "$profiles" | sed 's/[[:space:]]/g')"

i=0

while read -r profile; do
(( i += 1 ))
echo "# ============================================================================ #" >&2
echo "# AWS profile = $profile" >&2
echo "# ($i/$total_profiles) AWS profile = $profile" >&2
echo "# ============================================================================ #" >&2
export AWS_PROFILE="$profile"
cmd=("$@")
Expand All @@ -65,4 +71,4 @@ while read -r profile; do
eval "${cmd[@]}"
echo >&2
echo >&2
done
done <<< "$profile"

0 comments on commit debd218

Please sign in to comment.