비슷한 이름의 저장소 복제

비슷한 이름의 저장소 복제

나는 다음과 같은 것을하고 싶습니다 :

git clone https://github.com/meteor{A,B,C,D}test

{}하지만 bash는 the를 각각으로 변환하지 않습니다 . 내가 도대체 ​​뭘 잘못하고있는 겁니까?

답변1

사용 중인 구문은 {A,B,C,D}유효하지만 인수 분할이 발생합니다. 이는 명령이 다음과 같이 실행됨을 의미합니다.

git clone https://github.com/meteorAtest https://github.com/meteorBtest https://github.com/meteorCtest https://github.com/meteorDtest

원하는 것은 4개의 다른 명령을 실행하는 것입니다. 이를 수행하는 간단한 방법 중 하나는 for루프입니다.

for url in https://github.com/meteor{A,B,C,D}test; do git clone "$url"; done

답변2

당신은 또한 이것을 할 수 있습니다

echo https://github.com/meteor{A,B,C,D}test | xargs -n 1 -d ' ' git clone

echo는 이를 4개의 git url로 확장하고 git clone복제합니다.

관련 정보