So I have the multi module project and each module is in separate repository on bitbucket.
I try to write bush script that will provide cloning all repos I need, then load the folder with clonning module, run there npm install
command and run cd ../
to load the previous folder.
I wrote the next script:
repositories=(
"ssh://git@bitbucket.repo:22/db/firstRepo.git"
"ssh://git@bitbucket.repo:22/db/secondRepo.git"
"ssh://git@bitbucket.repo:22/db/thirdRepo.git"
)
echo "Start clonning"
clone_from_git() {
echo "Clone from ${1}..."
git clone ${1}
echo "Done!"
cd #some repo
echo "Start npm install..."
npm install
echo "Done!"
cd ../
}
for repo in "${repositories[@]}"
do
clone_from_git $repo
done
echo "Cloning done"
But after cloning I need to load cloned folder so, if the repo was cloned from, for example, ssh://git@bitbucket.repo:22/db/firstRepo.git
, than I need to run cd firstRepo
. Is it possible to split each of repositories
elements to get only folder name of clonning repo?
Thanks!