I cannot figure out (with my limited bash scripting skills) how solve this, i want somehow to combine variables in a bash script. I'm trying the following:
#!/bin/bash
basearch=x86_64
ol7_channels="ol UEKR4 UEKR3"
ol6_channels="ol UEKR4 UEKR3 UEK"
ol5_channels="ol UEK"
for version in 7 6 5
do
for channel in ${ol${version}_channels}}
do
printf "Oracle Linux $version $channel $basearch"
done
done
The desirable output would be:
OracleLinux 7 ol x86_64
OracleLinux 7 UEKR4 x86_64
OracleLinux 7 UEKR3 x86_64
OracleLinux 6 ol x86_64
OracleLinux 6 UEKR4 x86_64
OracleLinux 6 UEKR3 x86_64
OracleLinux 5 ol x86_64
OracleLinux 5 UEKR4 x86_64
OracleLinux 5 UEKR3 x86_64
I understand putting a variable inside a variable like i have done doesn't work. Can anyone show me a way how to acheive this?