diff --git a/nshlib/nsh_consolemain.c b/nshlib/nsh_consolemain.c index 5ff9f0ed0..e213c4cd2 100644 --- a/nshlib/nsh_consolemain.c +++ b/nshlib/nsh_consolemain.c @@ -96,12 +96,6 @@ int nsh_consolemain(int argc, char *argv[]) /* Execute the start-up script */ nsh_initscript(&pstate->cn_vtbl); - -#ifndef CONFIG_NSH_DISABLESCRIPT - /* Reset the option flags */ - - pstate->cn_vtbl.np.np_flags = NSH_NP_SET_OPTIONS_INIT; -#endif #endif #ifdef CONFIG_NSH_NETINIT diff --git a/nshlib/nsh_script.c b/nshlib/nsh_script.c index cf77ef964..cf0d53613 100644 --- a/nshlib/nsh_script.c +++ b/nshlib/nsh_script.c @@ -191,6 +191,12 @@ int nsh_initscript(FAR struct nsh_vtbl_s *vtbl) { ret = nsh_script(vtbl, "init", NSH_INITPATH); +#ifndef CONFIG_NSH_DISABLESCRIPT + /* Reset the option flags */ + + vtbl->np.np_flags = NSH_NP_SET_OPTIONS_INIT; +#endif + #if defined(CONFIG_NSH_ARCHINIT) && defined(CONFIG_BOARDCTL_FINALINIT) /* Perform architecture-specific final-initialization (if configured) */