我遇到了shell脚本的问题,希望您可以帮忙。
我想优化下面的代码的HTML格式:Linux busybox shell脚本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
我删除了回声-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标记之间的内容粘贴到myfile中,这是一个CGI脚本。
这可能是问题吗?
感谢试图帮助的人。 我应该在一开始就让这个问题更清楚,因为这有点令人困惑。 问题解决了。 –