awk 출력의 일부를 읽으려면

awk 출력의 일부를 읽으려면

변수를 출력하고 새 명령에 입력하려고 합니다.

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

출력을 주세요. XY-1234여기에 문제가 있습니다.

xxxx가 있는 ISSUE 섹션으로 전달해야 합니다 ... 디스플레이 공백 XY-1234에 전달 하고 $name으로 변수를 생성하고 $name을 전달해도 작동하지 않는 방법은 다음과 같습니다.$0/1/2name=$(awk '{print $2}')

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

답변1

jira.sh/awk 출력을 변수로 가져와야 합니다.

그럼 이건 어때요?

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"

관련 정보