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