#!/bin/bash

aws-fusion config-switch region
# If non-zero status from program, then exit from here
[ $? -ne 0 ] && return

selected_region="$(cat ~/.aws/fusion/region)"

if [ -z "$selected_region" ]
then
  # Unset region as it is same one mentioned in the current profile
  unset AWS_REGION
else
  export AWS_REGION="$selected_region"
fi