2

This might be a naive question, but I'm really not sure how to do it. I submit a spark job and I get the following output.

Run job succeeded. Submission id: driver-20170824224209-0001

I want to programmatically query the status of this job. How can I use the output in the console to extract the id to a variable using a bash script. Any help appreciated.

Share a link to this question
CC BY-SA 4.0
1
  • Do you mean when you run a program, it outputs that string Run job... and you want to get the id from that string into a variable?
    – lurker
    Nov 6 '18 at 23:44
5

Let's say you command is cmd and you want to store the output of the command in ( say ) a variable called res, one way in bash is to run the command in single quotes

res=`cmd`

or embed the command within $()

res=$(cmd)

Capture both stdout and stderr in Bash

Share a link to this answer
CC BY-SA 4.0
1
  • The characters in the first format are actually backticks ` rather than single quotes '
    – Biggsy
    Mar 24 at 13:38

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.