
비슷한 패턴을 공유하는 다음 파일을 만드는 프로세스가 있습니다.
file_1.txt
file_2.txt
.
.
.
file_1000.txt
.
.
.
file_1901.txt
file_1902.txt
1890
하지만 폴더에는 파일 만 있습니다 . 패턴을 공유하는 파일 목록에서 누락된 파일을 확인할 수 있는 방법이 있는지 알고 싶습니다.
답변1
#!/bin/bash
for i in {1..2000}
do
file_name="file_${i}.txt"
if [ ! -f ${file_name} ]
then
echo "${file_name} not exists.."
fi
done
for i in {1..2000};do file_name="file_${i}.txt"; [ -f ${file_name} ] || echo "${file_name} not exists"; done