I am deploying my shell script to a CI pipeline, there are three different environment variables defined on CI: $prod, $dev, $test.
My script managed to return the correct string value based on deployment type:
#!/bin/sh
my_env = // the checking logic
the value of my_env is a string value of one of 'prod', 'dev' or 'test'
I wonder how can I make a variable out of my_env to point to the value to either $prod or $dev or $test dynamically now in my script? I mean I can't $my_env since it only hold the string value e.g. dev instead of the actual value of $dev.
case $varname in prod) stuff=$prod;; dev) stuff=$dev;; test) stuff=$test;; esac– ilkkachu Mar 07 '22 at 10:26/bin/shellis or what the syntax with//means. – Kusalananda Mar 07 '22 at 15:18