假设我编写了一个 bash 脚本来执行此操作
#!/bin/bash
vulcan build -v -s .-c "./configure --enable-static etc.. etc..
该命令的输出包括
->> Downloading build artifacts to
(available at http://myapp.herokuapp.com/{guid}
我将如何解析显示在终端上的响应以捕获此 url?
var="->> Downloading build artifacts to
(available at http://myapp.herokuapp.com/{guid}"
echo ${var#*available at }
输出:
http://myapp.herokuapp.com/{guid}
要将命令的输出捕获到变量中var
:
var=$(vulcan build -v -s .-c "./configure --enable-static etc.. etc..)
基本上是:
var=$(yourcommand)