summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--variable.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/variable.c b/variable.c
index 25491c4..3dc8a22 100644
--- a/variable.c
+++ b/variable.c
@@ -918,15 +918,18 @@ target_environment (struct file *file)
break;
case v_noexport:
- /* If this is the SHELL variable and it's not exported, then
- add the value from our original environment. */
- if (streq (v->name, "SHELL"))
- {
- extern struct variable shell_var;
- v = &shell_var;
- break;
- }
- continue;
+ {
+ /* If this is the SHELL variable and it's not exported,
+ then add the value from our original environment, if
+ the original environment defined a value for SHELL. */
+ extern struct variable shell_var;
+ if (streq (v->name, "SHELL") && shell_var.value)
+ {
+ v = &shell_var;
+ break;
+ }
+ continue;
+ }
case v_ifset:
if (v->origin == o_default)