
The script generates files owned by root so it needs to be removed with sudo. As the removal of the directory is the last command, its failure causes the script to fail.
The script generates files owned by root so it needs to be removed with sudo. As the removal of the directory is the last command, its failure causes the script to fail.