I'm trying to execute the following printf statement in a zsh script I'm working on:
printf "%s\n" "${CREATE_WS[@]}"
Where $CREATE_WS is an indexed array as follows:
CREATE_WS=("************************************************************************" \
"You are about to create the $workspace workspace using the" \
"version set $versionset. Do you want to continue?" \
"************************************************************************" \
" ")
Where $workspace and $versionset are taken from command line arguments. If I echo both variables by themselves, the console shows that they are non-null and have the string that was entered on the command line. However, when the printf statement runs, the variables do not expand into the strings that they contain as expected, and are printed as though they are null.
I've tried wrapping the variables in curly braces like so: ${versionset}. But this also doesn't give me the desired behavior. What have I written wrong in this procedure, and how do I correct it?
CREATE_WS, not when you use it.$workspaceand$versionsetvariables set when you executed theCREATE_WS=statement?