I am writing a Bash script where I have to list the AWS access keys for a user, and then assign them to variables.
A user may have two access keys. So the user will need two variables to store those keys.
This is the line I have so far:
aws iam list-access-keys --user-name "$user_name" --profile="$aws_key" | grep -i accesskeyid | awk '{print $2}' | sed 's/"//g'
The output would be something like this:
AKIAJS7KDACQRQ5FJWA
AKIAICDDTVTMEAB6RM5Q
How can I assign each of those to its own variable in Bash?