
예를 들어 다음과 같은 파일 구조가 있습니다.
c
-Git
-GitBranchTest
.acignore
[lots more files]
-subfolder
.acignore
[lots more files]
모든 .acignore 파일의 복사본을 만들고 이름을 .gitignore로 바꾸려고 합니다. 완료되면 다음과 같이 보일 것입니다.
c
-Git
-GitBranchTest
.acignore
.gitignore
[lots more files]
-subfolder
.acignore
.gitignore
[lots more files]
내가 시도한 것과 내가 얻은 오류는 다음과 같습니다.
이것이 충분히 명확하기를 바랍니다. 도와주세요.
답변1
이렇게 하면 트릭을 수행할 수 있습니다.
find ./ -name '.acignore' | sed 's/.acignore//g' | xargs -I {} cp {}.acignore {}.gitignore
"c" 디렉터리 안에 있으면 "./"입니다. 위에 있으면 "./c"입니다.
답변2
작동하지만 매우 장황한 시도입니다. :)
for i in $(find /c/Git/GitBranchTest -name ".*" -print | grep acignore);do
from=$i
replacement=.gitignore
to=${from/.acignore/$replacement}
echo "cp $from $to" | sh
done