]> Sergey Matveev's repositories - zsh-autoenv.git/blobdiff - autoenv.zsh
Fix _autoenv_deauthorize with regard to newline handling, add tests
[zsh-autoenv.git] / autoenv.zsh
index c710389be506ace2ca25ec2971953715b3d3c7ca..14e8159432c6e285225342ddd65f880f04ae4ee1 100644 (file)
@@ -154,8 +154,8 @@ _autoenv_authorize() {
 
 _autoenv_deauthorize() {
   local env_file=$1
-  if [[ -f $AUTOENV_ENV_FILENAME ]]; then
-    echo $(\grep -vF $env_file $AUTOENV_ENV_FILENAME) > $AUTOENV_ENV_FILENAME
+  if [[ -s $AUTOENV_ENV_FILENAME ]]; then
+    echo "$(\grep -vF $env_file $AUTOENV_ENV_FILENAME)" > $AUTOENV_ENV_FILENAME
   fi
 }