Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/bin/sh document OLDPWD and cd -



details:   https://anonhg.NetBSD.org/src/rev/a2f3038181cd
branches:  trunk
changeset: 765942:a2f3038181cd
user:      christos <christos%NetBSD.org@localhost>
date:      Sat Jun 11 14:37:36 2011 +0000

description:
document OLDPWD and cd -

diffstat:

 bin/sh/sh.1 |  24 ++++++++++++++++++------
 1 files changed, 18 insertions(+), 6 deletions(-)

diffs (72 lines):

diff -r a549228f514f -r a2f3038181cd bin/sh/sh.1
--- a/bin/sh/sh.1       Sat Jun 11 13:52:46 2011 +0000
+++ b/bin/sh/sh.1       Sat Jun 11 14:37:36 2011 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: sh.1,v 1.99 2010/06/03 02:05:02 dholland Exp $
+.\"    $NetBSD: sh.1,v 1.100 2011/06/11 14:37:36 christos Exp $
 .\" Copyright (c) 1991, 1993
 .\"    The Regents of the University of California.  All rights reserved.
 .\"
@@ -31,7 +31,7 @@
 .\"
 .\"    @(#)sh.1        8.6 (Berkeley) 5/4/95
 .\"
-.Dd June 2, 2010
+.Dd June 11, 2011
 .Dt SH 1
 .Os
 .Sh NAME
@@ -1234,6 +1234,13 @@
 .Ar directory
 in the current directory name with
 .Ar replace .
+If
+.Ar directory
+is
+.Sq - ,
+then she current working directory is changed to the previous current
+working directory as set in
+.Ev OLDPWD .
 Otherwise if an entry for
 .Ev CDPATH
 appears in the environment of the
@@ -1254,14 +1261,18 @@
 .Fl P
 option instructs the shell to update
 .Ev PWD
-with the specified directory and change to that directory.
+with the specified physical directory path and change to that directory.
 This is the default.
 .Pp
+When the directory changes, the variable
+.Ev OLDPWD
+is set to the working directory before the change.
+.Pp
 Some shells also support a
 .Fl L
 option, which instructs the shell to update
 .Ev PWD
-with incorrect information and to change the current directory
+with the logical path and to change the current directory
 accordingly.
 This is not supported.
 .Pp
@@ -1479,7 +1490,7 @@
        \e?)    echo $USAGE; exit 1;;
        esac
 done
-shift `expr $OPTIND - 1`
+shift $(expr $OPTIND - 1)
 .Ed
 .Pp
 This code will accept any of the following as equivalent:
@@ -1671,7 +1682,8 @@
 may be null, which cause the specified signals to be ignored.
 With
 .Ar action
-omitted or set to `-' the specified signals are set to their default action.
+omitted or set to 
+.Sq - the specified signals are set to their default action.
 When the shell forks off a subshell, it resets trapped (but not ignored)
 signals to the default action.
 On non-interactive shells, the



Home | Main Index | Thread Index | Old Index