###前提・実現したいこと
異なる複数のフォルダ内に、それぞれ同じ名前の画像ファイルが入っている場合に、その画像を一気に取り出してhtmlで表示するscriptをbashで書きたい。
ファイル構成はこのようになっています。
folder1/try1/A.png
folder1/try2/A.png
folder1/try3/A.png
folder1/try4/A.png
folder2/try1/A.png
folder2/try2/A.png
folder2/try3/A.png
folder2/try4/A.png
###発生している問題・エラーメッセージ
folder名とその下のtry名を変数として設定してみたつもりなのですが、
全ての画像が表示されず困っています。
###ソースコード
#!/bin/bash
LIST1='folder1 folder2'
LIST2='try1 try2 try3 try4'
for j in $LIST1
do
for i in $LIST2
do
cat << EOF > ./result.html
<html> <head> <body> <table border=1 align=center> <tr> <th></th> <th>tmp-$i</th> </tr> <tr> <td>tmp-$j</td> <td><img src="./tmp-$j/tmp-$i/A.png" width="384"></img></td> </tr> </table> </body> </head> </html> EOF done done###補足情報(言語/FW/ツール等のバージョンなど)
OS はMacです。
回答3件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2016/03/16 06:46
2016/03/16 07:30