Re: incrementing number added to directory



In article <1125413379.213656.89640@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>,
"Niv (KP)" <kev.parsons@xxxxxxxxxx> writes:
> Ta for that; the below now works.
> It was just getting the syntax just right, I was almost there
> by myself, but not quite.
> #-----------------------------­------------------------------­--
> # initialise the module testbench directory counter.
> set n 00
> set uscore _
> # Create the test bench directory for each module.
> foreach entry $modules {
> incr n
> set m [format "%02d" $n]
> foreach bench_dir {FRED PETE KEV SIMON} {
> set longname [set m][set uscore][set entry]
> file mkdir $tbench_path/BENCH_ML_$longnam­e/$bench_dir
> }
> }
> #-----------------------------­------------------------------­--

Hi Niv,

a bit shorter and, IMHO, better readable:

# initialise the module testbench directory counter.
set n 0
# Create the test bench directory for each module.
foreach entry $modules {
set longname [format "BENCH_ML_%02d_%s" [incr n] $entry]
foreach bench_dir {FRED PETE KEV SIMON} {
file mkdir [file join $tbench_path $longname $bench_dir]
}
}


Best regards

Ulrich

.