aws-cli major version 判断
作者:互联网
使用了两个版本的 cli 需要特别处理
AWS_CLI_MAJOR_VERSION=$(aws --version 2>&1 | cut -d " " -f1 | cut -d "/" -f2 | cut -d "." -f1)
if [ "$AWS_CLI_MAJOR_VERSION" = "1" ]; then
echo "aws-cli verion is 1"
$(aws ecr get-login --no-include-email --region cn-northwest-1)
else
echo "aws-cli version is 2"
aws ecr get-login-password | docker login --username AWS --password-stdin account-id.dkr.ecr.region.amazonaws.com.cn
fi
标签:major,cut,cli,--,AWS,aws,version 来源: https://blog.csdn.net/power_to_go/article/details/122730564