find
コマンドの実行結果をシェル変数$file
に格納したいのであれば、find
のコマンドラインオプションを包むのはシングルクォーテーション('
) ではなく、バッククォーテーション(`
)ではないでしょうか。また、*.mp4
の指定部分でワイルドカードの展開が行われてしまうので、"
でくくってください。結果として、以下のようになるはずです。
bash
1file=`find ./ -maxdepth 3 -type f -name "*.mp4"` && for f in $file ; do echo $f ; done
実行例です。
bash
1$ ls -1 *.mp4
2test1.mp4
3test2.mp4
4test3.mp4
5test4.mp4
6
7$ file=`find ./ -maxdepth 3 -type f -name "*.mp4"` && for f in $file ; do echo $f ; done
8./test1.mp4
9./test2.mp4
10./test3.mp4
11./test4.mp4
12
13$ echo $file
14./test1.mp4 ./test2.mp4 ./test3.mp4 ./test4.mp4
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2020/05/30 01:04