Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

npm install subdirectories using gnu parallel

Tags:

gnu-parallel

I am trying to install a set of sub-directories from the parent dir using GNU parallel.

I'd like to run certain commands for all directories.

Installing

ls -d -- */ | grep -v 'node_modules' | parallel "npm i"

Removing node_modules

ls -d -- */ | grep -v 'node_modules' | parallel "rm -rf node_modules"

Create README.md

ls -d -- */ | grep -v 'node_modules' | parallel "touch README.md"

How can I fire the first argument of parallel as a command within each directory passed to parallel?

like image 512
ThomasReggi Avatar asked Dec 07 '25 17:12

ThomasReggi


1 Answers

ls -d -- */ | grep -v 'node_modules' | parallel "cd {} && npm i"
like image 52
ThomasReggi Avatar answered Dec 10 '25 08:12

ThomasReggi



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!