From 3f056d8ef2b5eec8cc0401a0e9420977d5b248ea Mon Sep 17 00:00:00 2001 From: rsc Date: Wed, 10 Aug 2005 16:59:19 +0000 Subject: Make fn cd safe for rc -e. --- rcmain | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/rcmain b/rcmain index 2a0174bf..448de029 100644 --- a/rcmain +++ b/rcmain @@ -24,9 +24,16 @@ if(! ~ $#cflag 0){ } if(flag i){ if(~ $TERM 9term){ - if(~ $#'fn#cd' 0) - fn cd { builtin cd $1 && flag i && awd } - awd + fn cd { + # builtin cd $1 && flag i && awd + # is not sufficient when running in a subshell + # that is rc -e (like mk uses!) + if(builtin cd $1){ + if(flag i) $PLAN9/bin/9 awd || status='' + status='' + } + } + $PLAN9/bin/9 awd } if(flag l && test -r $home/lib/profile) . $home/lib/profile status='' -- cgit v1.2.3