bash - bash中的循环覆盖
问题描述
这里发生了什么?
content=$(curl -s http://localhost:3000 -I | grep -Fi Content-Type | awk '{print $2}')
echo "${content}1234"
资源:
1234ication/x-protobuf
curl -I
回应是
HTTP/1.1 200 OK
X-Powered-By: Express
Content-Type: application/x-protobuf
Content-Encoding: gzip
Content-Length: 10013
Date: Tue, 14 Aug 2018 18:00:06 GMT
Connection: keep-alive
如您所见,网络服务器是一个普通的 express 应用程序,没有中间件,所有样板,没什么特别的
此外,检查
if [ "$content" == "application/x-protobuf" ]
总是错误的(我也尝试过其他的条件变体)
- 什么是循环覆盖业务
- 为什么屏幕上打印的内容不是内容?
解决方案
推荐阅读
- jquery - 如何在带有 vue 绑定的输入文本框中使用 JQuery inputmask?
- python - 试图将网页中的 JS 数据输出到 .html 输出文件中
- unix - 将行转置为列,在 shell 中保留一些行作为参考
- validation - 训练并没有提高模型在验证数据上的性能
- c++ - 无法从隐式继承的超类构造函数c ++创建子类
- sql-server - DatagridView 中的动态数据透视表
- c# - C# 日志和代码停止工作,如何解决?
- php - 将新主题和文件发布到 Brightsapce API 时出现错误 400
- c# - ASP.NET MVC,创建带参数的视图,POST提交时出错
- openmpi - 如何使用 OpenMPI 将进程运行到特定物理内核?