summaryrefslogtreecommitdiff
path: root/shell.c
diff options
context:
space:
mode:
authorChet Ramey <chet.ramey@case.edu>2017-02-22 11:09:11 -0500
committerChet Ramey <chet.ramey@case.edu>2017-02-22 11:09:11 -0500
commitac495185aab17ef6030a02ddc0be33380a27a94d (patch)
tree3016c147c550e606b2a44f086784ffe0afba1128 /shell.c
parent7e92fb358bb54f5acd5e71ef2d8f5e841c5d4320 (diff)
downloadbash-ac495185aab17ef6030a02ddc0be33380a27a94d.tar.gz
commit bash-20170210 snapshot
Diffstat (limited to 'shell.c')
-rw-r--r--shell.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/shell.c b/shell.c
index f577ae20..17962a99 100644
--- a/shell.c
+++ b/shell.c
@@ -223,6 +223,8 @@ int dump_po_strings; /* Dump strings in $"..." in po format */
int wordexp_only = 0; /* Do word expansion only */
int protected_mode = 0; /* No command substitution with --wordexp */
+int pretty_print_mode = 0; /* pretty-print a shell script */
+
#if defined (STRICT_POSIX)
int posixly_correct = 1; /* Non-zero means posix.2 superset. */
#else
@@ -251,6 +253,7 @@ static const struct {
{ "noprofile", Int, &no_profile, (char **)0x0 },
{ "norc", Int, &no_rc, (char **)0x0 },
{ "posix", Int, &posixly_correct, (char **)0x0 },
+ { "pretty-print", Int, &pretty_print_mode, (char **)0x0 },
#if defined (WORDEXP_OPTION)
{ "protected", Int, &protected_mode, (char **)0x0 },
#endif
@@ -779,6 +782,14 @@ main (argc, argv, env)
shell_initialized = 1;
+ if (pretty_print_mode && interactive_shell)
+ {
+ internal_warning (_("pretty-printing mode ignored in interactive shells"));
+ pretty_print_mode = 0;
+ }
+ if (pretty_print_mode)
+ exit_shell (pretty_print_loop ());
+
/* Read commands until exit condition. */
reader_loop ();
exit_shell (last_command_exit_value);