This reminds me of something I perform all of the time... not pure bash, but helpful nonetheless.
I have about ~50 git repos I'm pulling down and tracking (others' projects, not mine), so this gnu parallel command says "enter each git repo in the current dir and perform a git pull".
cd path-to-git-repos
parallel cd{}\; git pull ::: `ls`
Best part ... it runs in parallel. So I have 4 cpus and the git repos have nothing to do with each other... it runs four pulls at once.
It uses the output of the command as an input source. $(ls) would have done the same thing... I like to think of it as performing the operation on a current set.
It doesn't look familiar because its a specific parallel command option, not a general bash option.
Another silly example of a clock-counter ... the -k flag says keep the order (so things don't happen out of order). Perform an echo operation on three sets.
This reminds me of something I perform all of the time... not pure bash, but helpful nonetheless.
I have about ~50 git repos I'm pulling down and tracking (others' projects, not mine), so this gnu parallel command says "enter each git repo in the current dir and perform a git pull".
Best part ... it runs in parallel. So I have 4 cpus and the git repos have nothing to do with each other... it runs four pulls at once.
That’s awesome!
Would you explain the
:::part? I haven’t seen this syntax before. All I can find is that:meanstrueor something like that.It uses the output of the command as an input source. $(ls) would have done the same thing... I like to think of it as performing the operation on a current set.
It doesn't look familiar because its a specific parallel command option, not a general bash option.
Another silly example of a clock-counter ... the -k flag says keep the order (so things don't happen out of order). Perform an echo operation on three sets.