
find -exec オプションを使用していくつかのコマンドを実行したいのですが、このコードのどこが間違っているのかわかりません。現在、最初の検索結果のみが処理され、その後停止します。OS X で bash を使用しています。
read -e DIRECTORY
find $DIRECTORY -type f -name '*.mov' -exec sh -c '
file="$0"
echo "Processing $file ..."
modmovie -notrack "Timecode Track" $file -save-in-place
read line </dev/tty
' {} \;
答え1
私はこの例を思いつきましたが、他の人がコメントで言っているように、これがread line </dev/tty
ユーザー入力を待つ原因となっています。
#!/bin/bash
find db -type f -name '*.jpg' -exec sh -c '
file="$0"
echo "hi"
echo "$file"
read line </dev/tty
' {} \;
私のスクリプトの出力
hi
db/db1440/gothamgardenxmas21440.jpg
<---- I hit enter here
hi
db/db1440/unveiling11440.jpg
<---- I hit enter here
hi
db/db1440/astronomer21440.jpg
<---- I hit enter here
...