Below is the sample code,
top_dir=(network_dir telecomm_dir)
network_dir=(dijkstra patricia)
telecomm_dir=(CRC32 FFT adpcm gsm)
for bench in ${top_dir[@]}; do
for subdir in ${$bench[@]}; do
make -C $subdir
done
done
What I have is two directories, each of them has subdirectories. I want to iterate each directory and do make. When I run this script, it give me the error message,
./run.sh: line 21: ${$bench[@]}: bad substitution
Is it possible to let bash use variable ''bench'' to access network_dir and telecomm_dir? Thanks!