0
我需要把$輸入放入拼寫的文件..但是這段代碼將文件留空。我只是糾正數組中出現的第一個單詞,所以我在想,當我點擊「Enter」時,它正在重寫文件?任何幫助?
# store words in file
cat $1 | ispell -l > file
# move words in file into array
array=($(< file))
# remove temp file
rm file
# print out words & ask for corrections
for ((i=0; i<${#array[@]}; i++))
do
read -p "' ${array[i]} ' is mispelled. Press "Enter" to keep
this spelling, or type a correction here: " input
echo $input > spelled
done
# show corrections
cat spelled