开发者

bash find command not giving the output i would expect

Im trying to get the hang of the command find but im kind of confused as to why i get this kind of output from this code can anyone explain? Output:

file1
file2
file3
etc...
good morning

What i want is

file1
good morning
file2开发者_如何学C
good morning
file3
good morning

etc....

for line in `find $1 -type f`
do  
    echo $line
    echo hello good morning                     
done

Thanks in advance


You code should work. This is another way to try it:
find . -type f -exec echo -e {}"\n" good morning \;


Or

find $1 -type f -print -exec echo good morning \;

or even shorter if you have gnu-find

find $1 -type f -printf "%p\ngoog morning\n"
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜