1
我正在運行一個Bash腳本,它循環遍歷目錄中的文件並將它們全部附加到單個文件中。在bash循環中添加文件是添加^ M
但是,我發現^ M正被添加到每一行的末尾。
原始文件不包含此轉義字符,並且在命令行上手動追加文件不會插入該字符。
我不知道它的問題,但我使用eval構造,然後檢索下面的目錄名稱:
構建目錄名稱:
declare ${schema}_${type}_${subtype}="$(eval echo \$${schema}_${type}_${subtype}) $(echo $file | egrep -v "$excluded_types" | grep $schema/$type/$subtype)"
檢索目錄名稱:
for file in $(eval echo \$${schema}_${type}_${subtype})
do
echo -e "\t\t\t$file"
echo -e "\t\t\t$file\n" >> $log_file
cat $file >> $output_file
done
謝謝。生成的文件上的dos2unix也起作用。 – retrodev 2011-02-14 12:01:18