シェル スクリプトに問題があり、お役に立てば幸いです。次のコードの HTML フォーマットを最適化したい:
#! /bin/sh
cat <<EOF > myfile # temporary file
#! /bin/sh
echo -e "Content-type: text/html; charset=iso-8859-1\n\n"
echo -e "<html><head>\c"
echo -e "<title></title>"
echo -e "</head>"
echo -e "<body>\c"
echo -e "<p>Text</p>"
echo -e "</body></html>"
EOF
chmod 777 myfile
mount -o bind myfile myfile # mount temporary on the original myfile
rm myfile
および二重引用符を削除しましたecho -e
。私もこれを試しました:
#! /bin/sh
cat <<EOF > myfile # temporary file
#! /bin/sh
echo -e '
<html>
<head>
<title></title>
</head>
<body>
<p>Text</p>
</body>
</html>
'
EOF
chmod 777 myfile
mount -o bind myfile myfile # mount temporary on the original myfile
rm myfile
スクリプトの何が問題になっていますか?
注: 上記のコードは、再起動のたびにロードされる .cfg ファイルの内容です。.cfg ファイルは、EOF マーカー間のコンテンツを CGI スクリプトである myfile に貼り付けます。
それが問題でしょうか?