Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

3
  • How can I record the PID number returned by this code in a bash variable? For a reason unclear to me, stdout does not seem to be recorded in this example: RESULT="$(./start_and_get_pid.out echo yo)"; echo "$RESULT" Commented Nov 8, 2018 at 1:27
  • @Tfb9: I'd honestly recommend one of the other approaches; I wrote this 2+ years ago and it's by far one of the hackier/error-prone methods presented (or so I think). Commented Nov 8, 2018 at 1:30
  • Thanks for the note. I think I solved my problem with this sleep 10 & PID_IS=$!; echo $PID_IS Commented Nov 9, 2018 at 0:33