Created
August 22, 2023 14:39
-
-
Save zr0n/8bcde92ee01c46b640672b142479794d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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