我有一些文件,如:如何使文件從FILE {1-3}變量值for循環?
FILE1="apple.txt"
FILE2="grapes.txt"
FILE3="strawberry.txt"
我怎麼能在bash使這些文件?
我嘗試這樣做,但我得到了一個錯誤......
for f in {1..3}
do
echo hello > $(FILE$f)
done
錯誤:
./make_files.sh: line 48: FILE1: command not found
./make_files.sh: line 48: $(FILE$f): ambiguous redirect
我需要它們含有你好3 txts,蘋果,葡萄和草莓。
它寫出你好,到FILE1,FILE2,FILE3。但是我需要向apple.txt寫出你好,等等。 – tmsblgh