Bash에서 파일이 비어 있는지 확인하는 방법은 무엇입니까? 저는 diff라는 파일을 가지고 있습니다.txt. 빈지 확인하고 싶습니다. 아래와 같은 bash 스크립트를 작성했지만 작동하지 않았습니다. if [ -s diff.txt ] then touch empty.txt rm full.txt else touch full.txt rm emtpy.txt fi 사용해 보십시오. #!/bin/bash -e if [ -s diff.txt ]; then # The file is not-empty. rm -f empty.txt touch full.txt else # The file is empty. rm -f full.txt touch empty.txt fi 참고로, 제가 역할을 바꿨다는 것을(를)empty.txt그..