在脚本下面找到不附加到文本的结果。
file_vlist.txt文件内容文件名如下
blue
我的脚本名称是video.sh int,代码如下
filename1
filename2
....
结果会附加到格式不正确的文本
#!/bin/bash
filename="file_vlist.txt"
while read -r line
do
name="$line"
echo "*******video******** - $name\n" >> output_video_new.txt
find . -type f -exec grep -l '$name' '{}' \; >>output_video_new.txt
echo "*******video******** - $name\n" >> output_video_new.txt
done < "$filename"
答案 0 :(得分:0)
这对我有用:
#!/bin/bash
filename="filelines"
while read -r line
do
name="$line"
echo "*******video******** - $name" >> output_video_new.txt
find . -type f -exec grep -l $name {} \; >> output_video_new.txt
echo "*******video******** - $name" >> output_video_new.txt
done < "$filename"