diff options
Diffstat (limited to 'sh.exec.c')
-rw-r--r-- | sh.exec.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/sh.exec.c b/sh.exec.c index 2b41a5343bc2..bb0fa4873d31 100644 --- a/sh.exec.c +++ b/sh.exec.c @@ -1,4 +1,4 @@ -/* $Header: /p/tcsh/cvsroot/tcsh/sh.exec.c,v 3.79 2011/02/25 23:58:34 christos Exp $ */ +/* $Header: /p/tcsh/cvsroot/tcsh/sh.exec.c,v 3.81 2016/09/12 16:33:54 christos Exp $ */ /* * sh.exec.c: Search, find, and execute a command! */ @@ -32,7 +32,7 @@ */ #include "sh.h" -RCSID("$tcsh: sh.exec.c,v 3.79 2011/02/25 23:58:34 christos Exp $") +RCSID("$tcsh: sh.exec.c,v 3.81 2016/09/12 16:33:54 christos Exp $") #include "tc.h" #include "tw.h" @@ -606,9 +606,10 @@ execash(Char **t, struct command *kp) cleanup_push(&state, execash_cleanup); /* - * Decrement the shell level + * Decrement the shell level, if not in a subshell */ - shlvl(-1); + if (mainpid == getpid()) + shlvl(-1); #ifdef WINNT_NATIVE __nt_really_exec=1; #endif /* WINNT_NATIVE */ @@ -1070,6 +1071,9 @@ dowhere(Char **v, struct command *c) { int found = 1; USE(c); + + if (adrof(STRautorehash)) + dohash(NULL, NULL); for (v++; *v; v++) found &= find_cmd(*v, 1); /* Make status nonzero if any command is not found. */ @@ -1166,7 +1170,11 @@ retry: return rval; } } - if (adrof(STRautorehash) && !rehashed && havhash) { + /* + * If we are printing, we are being called from dowhere() which it + * has rehashed already + */ + if (!prt && adrof(STRautorehash) && !rehashed && havhash) { dohash(NULL, NULL); rehashed = 1; goto retry; |