Added support for set [{+|-}{e|x|xe|ex}] [<name> <value>]

Set the 'exit on error control' and/or 'print a trace' of commands when parsing scripts in NSH.  The settinngs are in effect from the point of exection, until they are changed again, or in the case of the init script, the settings are returned to the default settings when it exits.

Included child scripts will run with the parents settings and changes made in the child script will effect the parent on return.

Use 'set -e' to enable and 'set +e' to disable (ignore) the exit condition on commands. The default is -e. Errors cause script to exit.

Use 'set -x' to enable and 'set +x' to disable (silence) printing a trace of the script commands as they are ececuted. The default is +x. No printing of a trace of script commands as they are executed.
This commit is contained in:
David Sidrane
2017-04-05 18:25:59 -06:00
committed by Gregory Nutt
parent 74ae283487
commit d03aa9112e
7 changed files with 160 additions and 22 deletions

View File

@@ -136,10 +136,15 @@ int nsh_script(FAR struct nsh_vtbl_s *vtbl, FAR const char *cmd,
* considerable amount of stack may be used.
*/
if ((vtbl->np.np_flags & NSH_PFALG_SILENT) == 0)
{
nsh_output(vtbl,"%s", buffer);
}
ret = nsh_parse(vtbl, buffer);
}
}
while (pret && ret == OK);
while (pret && (ret == OK || (vtbl->np.np_flags & NSH_PFALG_IGNORE)));
/* Close the script file */