I want to construct a function that will change its user input prompt based on its parameter.
my_fucntion takes 1 parameter as db_host after prompting the user for input:
function provide_host () {
echo "Enter NAME OR IP OF ${function_param1} DATBASE HOST: "
read global function_param1_db_host
}
So if I call the function as
function provide_host (primary)
it should prompt as
echo "Enter NAME OR IP OF PRIMARY DATBASE HOST: "
but if I use
function provide_host (secondary)
it prompts
"Enter NAME OR IP OF SECONDARY DATBASE HOST: "
My idea is that I have to use an if statement for that, but I'm not sure if I can use the function's parameter as a variable for promptin the user inside the function.