Only clean if the file exists

This commit is contained in:
Graham Christensen 2017-07-12 20:31:33 -04:00
parent b2917c8246
commit 85acfcd6bd
No known key found for this signature in database
GPG Key ID: 06121D366FE9435C
1 changed files with 4 additions and 2 deletions

View File

@ -20,8 +20,10 @@ cleanup() {
done
for file in ~/.bash_profile ~/.bash_login ~/.profile ~/.zshenv ~/.zprofile ~/.zshrc ~/.zlogin; do
cat "$file" | grep -v nix-profile > "$file.next"
mv "$file.next" "$file"
if [ -e "$file" ]; then
cat "$file" | grep -v nix-profile > "$file.next"
mv "$file.next" "$file"
fi
done