Search code examples
bashvulcan

How to handle vulcan response from Bash Script


Say I write a bash script to do this

#!/bin/bash
vulcan build -v -s .-c "./configure --enable-static etc.. etc..

The output of this command includes

->> Downloading build artifacts to
(available at http://myapp.herokuapp.com/{guid}

How would I parse this response that displays on the terminal to capture this url?


Solution

  • var="->> Downloading build artifacts to
    (available at http://myapp.herokuapp.com/{guid}" 
    
    echo ${var#*available at }
    

    Output:

    http://myapp.herokuapp.com/{guid}
    

    To capture output of the command into variable var:

    var=$(vulcan build -v -s .-c "./configure --enable-static etc.. etc..)
    

    Which is basically:

    var=$(yourcommand)
    

    See here and here for more info about Parameter Expansion and Command Substitution.