0

假设我编写了一个 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?

4

1 回答 1

0
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)

有关参数扩展和命令替换的更多信息,请参见此处此处

于 2014-05-12T06:16:29.057 回答