Skip to content

Instantly share code, notes, and snippets.

@caramelchocolate
Created December 25, 2018 04:13
Show Gist options
  • Save caramelchocolate/910c154a402462287ef4039c09ce387d to your computer and use it in GitHub Desktop.
Save caramelchocolate/910c154a402462287ef4039c09ce387d to your computer and use it in GitHub Desktop.
Execute Any commands in parallel.
#!/bin/sh
cat <<-EOF | xargs -L1 -P4 sh -c
'sleep 3; echo "sleep3 end"'
'sleep 4; echo "sleep4 end"'
'sleep 2; echo "sleep2 end"'
'sleep 1; echo "sleep1 end"'
EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment