
Tenho um processo de criação dos seguintes arquivos, que compartilham um padrão semelhante.
file_1.txt
file_2.txt
.
.
.
file_1000.txt
.
.
.
file_1901.txt
file_1902.txt
Porém, existem apenas 1890
arquivos na pasta. Gostaria de saber se existe uma maneira de identificar os arquivos ausentes na lista de arquivos que compartilham um padrão.
Responder1
#!/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