Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

205
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda