npm install subdirectories using gnu parallel

2019-07-14 04:07发布

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?

1条回答
虎瘦雄心在
2楼-- · 2019-07-14 04:38
ls -d -- */ | grep -v 'node_modules' | parallel "cd {} && npm i"
查看更多
登录 后发表回答