現在、ファイルを指定のディレクトリ配下にコピーするというシェルスクリプトを組んでいます。
スクリプトを叩くと下記のようにディレクトリが存在しないと出ますが、ターミナル上でls test1/hoge/img/
とするとちゃんと出力されます。
エラー
$ ./test.sh cp: directory test1/hoge/img/ does not exist cp: directory test2/huga/img/ does not exist cp: directory test1/hoge/pdf/ does not exist cp: directory test2/huga/pdf/ does not exist cp: directory test1/hoge/img/ does not exist cp: directory test2/huga/img/ does not exist cp: directory test1/hoge/pdf/ does not exist ・ ・ ・
スクリプト
test.sh
1 2jpg1="test1/hoge/img/" 3jpg2="test2/huga/img/" 4pdf1="test1/hoge/pdf/" 5pdf2="test2/huga/pdf/" 6 7jpgArray=() // ファイルの配列 8 9for jpg in ${jpgArray[@]} 10do 11 cp ${jpg} ${jpg1} 12 cp ${jpg} ${jpg2} 13done 14 15for pdf in ${pdfArray[@]} 16do 17 cp ${pdf} ${pdf1} 18 cp ${pdf} ${pdf2} 19done
回答1件
あなたの回答
tips
プレビュー