I had the zsh script
printf '%s\0' www/scripts6/lib/* | xargs -0 -I{} -P 50 babel {} > {}
and it worked (i think.). But I needed to actually copy the files to the scripts
directory instead of scripts6
. Also, I needed to add an extra path to the list of paths manually, so I tried doing this:
paths=$(printf '%s\0' www/scripts6/lib/* | sed -e 's@www/scripts6/@@g')
paths=$paths'main.js'$'\0'
echo -n $paths | xargs -0 -I {} -P 50 babel www/scripts6/{} > www/scripts/{}
That was a BIG ACCOMPLISHMENT for me. Anyway, the script makes the file named {}
in the scripts
directory (and nothing in the scripts/lib
directory). This leads me to believe that only the first {}
in the code gets replaced by the argument, and not the second one (and I have no explanation for the absence of files in the scripts/lib
directory).
How can I make the script work as expected?
xargs
solution to this problem too, if anyone would like to share.