shell 复制文件到另一个文件,支持换行格式
方法一
方法二
#!/bin/bash
# 源文件名和目标文件名
source_file="=/etc/config/network"
target_file="target.txt"
# 逐行读取源文件内容并复制到目标文件
while IFS= read -r line; do
echo "$line" >> "$target_file"
done < "$source_file"
echo "文件复制完成。"
shell 复制文件到另一个文件,支持换行格式
#!/bin/bash
# 源文件名和目标文件名
source_file="=/etc/config/network"
target_file="target.txt"
# 逐行读取源文件内容并复制到目标文件
while IFS= read -r line; do
echo "$line" >> "$target_file"
done < "$source_file"
echo "文件复制完成。"