Source: https://victoria.dev/blog/how-to-write-bash-one-liners-for-cloning-and-managing-github-and-gitlab-repositories/
Given a list of GitHub URLs in the file gh-repos.txt, like this:
[email protected]:username/first-repository.git
[email protected]:username/second-repository.git
[email protected]:username/third-repository.git
<gh-repos.txt xargs -n1 git clone
To run a command for each line of our input, gh-repos.txt, we use xargs -n1.
The tool xargs reads items from input and executes any commands it finds (it will echo if it doesn’t find any).
By default, it assumes that items are separated by spaces; new lines also works and makes our list easier to read.
The flag -n1 tells xargs to use 1 argument, or in our case, one line, per command.
We build our command with git clone, which xargs then executes for each line. Ta-da.