Only clean if the file exists

This commit is contained in:
Graham Christensen 2017-07-12 20:31:33 -04:00
parent 92ca93528f
commit 3839dda2ec
No known key found for this signature in database
GPG key ID: 06121D366FE9435C

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