Check for the existence of a profile target before seeing if it mentions Nix

Grep would ignore files that didn't exist, but would complain
about files in a directory if the directory didn't exist. Simply check
for the directory first, prior to grepping it.
This commit is contained in:
Graham Christensen 2018-03-30 11:37:32 -04:00
parent 2921165a9d
commit 4ba91f5bae
No known key found for this signature in database
GPG Key ID: ACA1C1D120C83D5C

View File

@ -369,7 +369,7 @@ and try again.
EOF
fi
if grep -qi "nix" "$profile_target"; then
if [ -e "$profile_target" ] && grep -qi "nix" "$profile_target"; then
failure <<EOF
It looks like $profile_target already has some Nix configuration in
there. There should be no reason to run this again. If you're having