I am creating a script to check AWS Cli version and store it in a Variable to use it later.
#!/bin/bash
OS=$(uname -a)
AWS_CLI=$(aws --version)
echo echo "{\"changed\":false,\"kernal version\":\"$OS\",\"AWS CLI version\":\"$AWS_CLI\"}"
But the output is shown as following.
{
"AWS CLI version": "",
"kernal version": "Linux ip-10-0-14-174 ... x86_64 x86_64 x86_64 GNU/Linux"
}
How can I get the value of aws --version to bash variable?