【发布时间】:2018-02-16 01:45:01
【问题描述】:
cat /usr/lib/cgi-bin/test00.cgi
#!/bin/bash
echo "Content-type: text/html"
cat /tmp/file
结果是:
one two three four
如何像 bash 脚本一样格式化输出(带换行符)?
one
two
three
four
【问题讨论】:
-
你试过
text/plain而不是text/html吗? -
one two three four是从哪里打印出来的?echo字符串在哪里Content-type: text/html -
@Inian OP 正在编写 CGI 脚本。所以我假设 OP 指的是 网络浏览器 呈现结果 HTTP 响应的方式。
Context-type是 HTTP 标头的一部分,因此不直接可见。剩下的显然是/tmp/file的内容。