$我不工作......这让我发疯了!
for i in {1..200};
do echo "/scratch/inputTest/prob/timit.test.pg.list_10_$i_prob.bin" >> longProbList;
done
在文件中只有
/scratch/inputTest/prob/timit.test.pg.list_10_.bin
/scratch/inputTest/prob/timit.test.pg.list_10_.bin
/scratch/inputTest/prob/timit.test.pg.list_10_.bin
/scratch/inputTest/prob/timit.test.pg.list_10_.bin
/scratch/inputTest/prob/timit.test.pg.list_10_.bin
/scratch/inputTest/prob/timit.test.pg.list_10_.bin
/scratch/inputTest/prob/timit.test.pg.list_10_.bin
/scratch/inputTest/prob/timit.test.pg.list_10_.bin
/scratch/inputTest/prob/timit.test.pg.list_10_.bin
/scratch/inputTest/prob/timit.test.pg.list_10_.bin
/scratch/inputTest/prob/timit.test.pg.list_10_.bin
/scratch/inputTest/prob/timit.test.pg.list_10_.bin
/scratch/inputTest/prob/timit.test.pg.list_10_.bin
/scratch/inputTest/prob/timit.test.pg.list_10_.bin
/scratch/inputTest/prob/timit.test.pg.list_10_.bin
/scratch/inputTest/prob/timit.test.pg.list_10_.bin
/scratch/inputTest/prob/timit.test.pg.list_10_.bin
答案 0 :(得分:7)
它认为您的变量名称为$i_prob
,因为下划线是变量名称的有效字符。使用${i}
来解决此问题:
for i in {1..200};
do echo "/scratch/inputTest/prob/timit.test.pg.list_10_${i}_prob.bin" >> longProbList;
done
答案 1 :(得分:1)
你已经忘记了$ i周围的“”
for i in {1..200};
do echo "/scratch/inputTest/prob/timit.test.pg.list_10_"$i"_prob.bin" >> longProbList;
done