
다음은 가상 시나리오입니다. 파일이 표시되고 해당 파일을 tar에 추가한 다음 tar가 압축되는 보관 프로세스가 있습니다. 이 같은:
while sleep 1 ; do
new_files="$(some-command-to-scan-for files)"
tar --append --file xxx.tar $new_files
if [ condition ] ; then break; fi
done
cat xxx.tar | gzip | dd of=/another/directory/xxx-$(date).tgz
rm xxx.tar
내가 정말로 원하는 것은 주기가 진행됨에 따라 tar가 생성되고 압축되어 임시 파일이 필요하지 않게 되는 것입니다. 추가할 때는 기존 파일을 열고 끝을 찾아야 하기 때문에 불가능합니다. 내가 정말로 원하는 것의 "스케치"는 다음과 같습니다.
while sleep 1 ; do
new_files="$(some-command-to-scan-for files)"
tar --append --file - $new_files
if [ condition ] ; then break; fi
done | gzip | dd of=/another/directory/xxx-$(date).tgz
표준 출력으로 갈 때 tar에 더 많은 파일을 추가하는 방법이 있습니까?