Skip to content

Instantly share code, notes, and snippets.

@zr0n
Created August 22, 2023 14:39
Show Gist options
  • Save zr0n/8bcde92ee01c46b640672b142479794d to your computer and use it in GitHub Desktop.
Save zr0n/8bcde92ee01c46b640672b142479794d to your computer and use it in GitHub Desktop.
#!/bin/bash
max_attempts=2
attempt=1
file_to_check="seu_arquivo.txt"
while [ $attempt -le $max_attempts ]; do
if [ -e "$file_to_check" ]; then
echo "Arquivo encontrado. Deletando..."
rm "$file_to_check"
echo "Arquivo deletado."
break
else
echo "Arquivo não encontrado (tentativa $attempt)."
fi
attempt=$((attempt + 1))
done
echo "Fim do script."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment