Skip to content

Instantly share code, notes, and snippets.

@talhanai
Last active July 10, 2020 15:34
Show Gist options
  • Select an option

  • Save talhanai/14229fb24e281d0eccb2559c91437bfa to your computer and use it in GitHub Desktop.

Select an option

Save talhanai/14229fb24e281d0eccb2559c91437bfa to your computer and use it in GitHub Desktop.
An example for running a list of bash commands in parallel, while monitoring progress.
#!/bin/bash
# Create list of bash commands to execute
echo "echo "hello"; sleep 5;
echo "hello"; sleep 5;
echo "hello"; sleep 5;
echo "hello"; sleep 5;
echo "hello"; sleep 5;
echo "hello"; sleep 5;
echo "hello"; sleep 5;
echo "hello"; sleep 5;
echo "hello"; sleep 5;
echo "hello"; sleep 5;" > file.txt
# Process list of bash command in parallel, while tracking progress and ETA.
num_jobs_in_parallel=3
parallel --bar --eta -j ${num_jobs_in_parallel} < file.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment