Use the eval command. The eval command is designed to allow execution of a string that is built at runtime.
switch($timeOfDay) {
case "morning":
$shape = "circle";
break;
case "afternoon":
$shape = "sphere";
break;
case "evening":
$shape = "cone";
break;
default:
$shape = "cylinder";
}
eval $shape -r 5; // create specified shape with radius 5.
Alternatively, you could use eval with function syntax:
eval ($shape+" -r 5");
You can also use the evalEcho and evalDeferred commands.