aboutsummaryrefslogtreecommitdiffstats
path: root/builtins/evalstring.c
diff options
context:
space:
mode:
Diffstat (limited to 'builtins/evalstring.c')
-rw-r--r--builtins/evalstring.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/builtins/evalstring.c b/builtins/evalstring.c
index a0fb3e2..40abe00 100644
--- a/builtins/evalstring.c
+++ b/builtins/evalstring.c
@@ -43,6 +43,7 @@
#include "../execute_cmd.h"
#include "../redir.h"
#include "../trap.h"
+#include "../bashintl.h"
#include <y.tab.h>
@@ -51,6 +52,7 @@
#endif
#include "common.h"
+#include "builtext.h"
#if !defined (errno)
extern int errno;
@@ -67,6 +69,7 @@ extern int loop_level;
extern int executing_list;
extern int comsub_ignore_return;
extern int posixly_correct;
+extern sh_builtin_func_t *this_shell_builtin;
int parse_and_execute_level = 0;
@@ -324,6 +327,19 @@ parse_and_execute (string, from_file, flags)
{
last_result = EXECUTION_FAILURE;
+ if (interactive_shell == 0 && this_shell_builtin &&
+ (this_shell_builtin == source_builtin || this_shell_builtin == eval_builtin) &&
+ last_command_exit_value == EX_BADSYNTAX && posixly_correct)
+ {
+#if 0 /* XXX - for bash-4.2 */
+ should_jump_to_top_level = 1;
+ code = ERREXIT;
+ last_command_exit_value = EX_BADUSAGE;
+#else
+ internal_warning (_("syntax errors in . or eval will cause future versions of the shell to abort as Posix requires"));
+#endif
+ }
+
/* Since we are shell compatible, syntax errors in a script
abort the execution of the script. Right? */
break;