【发布时间】:2014-10-08 20:45:41
【问题描述】:
所以,假设我有以下命令:
curl -I http://google.com | head -n 1| cut -d $' ' -f2
这将捕获http状态码?? 现在我想在 bash 脚本中将它分配给变量..
like output = "curl -I http://localhost:8088/tracks?key=9 | head -n 1| cut -d $' ' -f2"
或类似的东西..
如何将上述命令的响应分配给 bash 中名为 output 的变量? 谢谢
【问题讨论】:
-
尝试用反引号包围命令
-
@Bohemian: D'oh.. :) 谢谢