I'm trying to output a variable & input to a new command:

jira.sh --action createIssue --project "BLAH" --type "Incident" --summary 
"THIS IS A TEST" --components "BLA" --priority "BLAH"| awk '{print $2}'

Gives me output XY-1234 which is the ISSUE

i need to pass in XY-1234 to the ISSUE section where the xxxx are... how can i go about passing this in $0/1/2 show blanks and creating a variable with name=$(awk '{print $2}') and passing in $name is not working either:

jira.sh --action addAttachment --issue "xxxxx" --file "/var/log/blah.log"

Need to get the jira.sh/awk output into a variable.

So how about this

JIRA=$(jira.sh --action createIssue \
               --project "BLAH" \
               --type "Incident" \
               --summary "THIS IS A TEST" \
               --components "BLA" \
               --priority "BLAH" | awk '{print $2}')

jira.sh --action addAttachment \
        --issue "$JIRA" \
        --file "/var/log/blah.log"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.