How can I process the results of find in a bash script?

前端 未结 5 734
闹比i
闹比i 2020-12-07 15:54

I\'m trying to use an array to store a list of file names using the find command.

For some reason the array fails to work in the bash used by the school

5条回答
  •  天命终不由人
    2020-12-07 16:01

    I was having issue with Johannes Weiß's solution, if I was just doing an echo it would work for the full list of files. However, if I tried running ffmpeg on the next line the script would only process the first file it encountered. I assumed some IFS funny business due to the pipe but I couldn't figure it out and ran with a for loop instead:

    for i in $(find . -name '*.mov' ); 
    do
        echo "$i"
    done
    

提交回复
热议问题