![비슷한 이름의 저장소 복제](https://linux55.com/image/38731/%EB%B9%84%EC%8A%B7%ED%95%9C%20%EC%9D%B4%EB%A6%84%EC%9D%98%20%EC%A0%80%EC%9E%A5%EC%86%8C%20%EB%B3%B5%EC%A0%9C.png)
나는 이런 일을하고 싶다 :
git clone https://github.com/meteor{A,B,C,D}test
그러나 bash는 각각을 변환하지 않습니다 {}
. 내가 뭘 잘못했나요?
답변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
복제합니다.