From c781d708da064b42af19e20113d042b65e886d94 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marc=20Cornell=C3=A0?= <marc.cornella@live.com>
Date: Wed, 8 Aug 2018 00:05:34 +0200
Subject: [PATCH] dotenv: test and warn of incorrect.env syntax

Fixes #6337
---
 plugins/dotenv/dotenv.plugin.zsh | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/plugins/dotenv/dotenv.plugin.zsh b/plugins/dotenv/dotenv.plugin.zsh
index a0c2d0051..b701b5596 100644
--- a/plugins/dotenv/dotenv.plugin.zsh
+++ b/plugins/dotenv/dotenv.plugin.zsh
@@ -1,5 +1,8 @@
 source_env() {
   if [[ -f .env ]]; then
+    # test .env syntax
+    zsh -fn .env || echo 'dotenv: error when sourcing `.env` file' >&2
+
     if [[ -o a ]]; then
       source .env
     else