Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

204
Views
Last run with different options GNU Parallel

I've parallelized a for cycle in bash using GNU Parallel. This is a very simple example to show what I want to reach:

seq 10 | parallel -n0 echo "Hello World" &

I would like to detach from terminal all the run, except the last one, thus removing the & only in the last cycle. Is there a way to do this?

EDIT: Since I was not very clear, I'll try to explain myself in a better way:

I have a simulator starting, then with GNU parallel I launch many times the same script that connect with the simulator. I want all of them detaching from the terminal except the last one to avoid confusion with overlapping output.

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

There is no option for that, but default is that the first job gets /dev/tty as input. So maybe you can run your last job first?

If you just want the output and not the input then this should work:

seq 10 | parallel echo Hello World '> {= $_= $job->seq() == total_jobs() ? "/dev/tty" : "/dev/null" =}'

(Requires version 20160122 or newer)

Otherwise a workaround is to save to files and output the last file:

seq 10 | parallel --files -n0 echo Hello World | tail -n1 | parallel -u cat
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!