How can I move a file to a dynamically determined name with bash?
I have a testprogram that writes some results into a file "result". I wanna run the program three times and then store the results in an appropriate file with the name result1, result2, etc.
I thought something along those lines will do the trick:
for (( i = 0 ; i <= 3; i++ ))
do
./testprogram
cp result result+'i' (?????)
rm res开发者_如何学编程ult
done
I am just not sure how I generate here the filename "result" + "i".
for i in {1..3}
do
./testprogram
mv results "result${i}"
done
cp result result$i
精彩评论