찾기 및 실행: 이 명령이 작동하지 않는 이유는 무엇입니까?

찾기 및 실행: 이 명령이 작동하지 않는 이유는 무엇입니까?

echo가 빈 줄을 인쇄하는 이유를 이해할 수 없습니다(최신 cygwin 버전).

~/tmp >find mydor/ -name "*php"
mydor/es/c/packags.php
mydor/etns/inx.php
mydor/pacepors.php
mydor/XAE.php

~/tmp >find mydor/ -name "*php" -exec echo {} \;
~/tmp >find mydor/ -name "*php" -exec echo "{}" \;
~/tmp >find mydor/ -name "*php" -exec echo '{}' \;

~/tmp >

~/tmp >find --version
find (GNU findutils) 4.5.11
Packaged by Cygwin (4.5.11-1)
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by Eric B. Decker, James Youngman, and Kevin Dalley.
Features enabled: D_TYPE O_NOFOLLOW(enabled) LEAF_OPTIMISATION FTS(FTS_CWDFD) CBO(level=2)

답변1

나는 답을 찾았습니다. 이것이 내가 작동하게 하는 방법입니다(첫 번째 프로세스가 성공한 경우에만 2개의 프로세스를 연속으로 실행하려면 Google에서 찾을 수 없는 솔루션입니다).

find ./ -name "*php" -exec sh -c "sed 's/ \+ /\t/g' \"{}\" > tmpfile && mv tmpfile \"{}\"" \;

관련 정보