for ($i=0; $i<($numCVs); $i++){ float $c = ($i-1); select -r ("waveCluster" + 2^$i); } ...like that? Actually I'm not sure what the interior stuff should be, but the function would be 2^$i.