Instantly share code, notes, and snippets.

Embed
What would you like to do?
#!/usr/bin/env bash
readonly SCRIPT_DIR=$(dirname $(readlink -m $0));
function main
{
if [ -z "$1" ] && [ -z "${2}" ]; then
error_exit "Argument Identifiant projet attentu : bash ${0} path"
fi
set -o errexit
set -o pipefail
set -o nounset
set -o errtrace
local path=$1
local files=$(find $path -name "*.html")
NPROC=0
for f in $files; do
# execute my commands here
# python script.py
NPROC=$(($NPROC+1))
if [ "$NPROC" -ge 10 ]; then
wait
NPROC=0
fi
done
}
function error_exit
{
echo "$1" 1>&2
exit 1
}
main "$@"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment