Module Name: src
Committed By: christos
Date: Sat Jun 11 14:37:36 UTC 2011
Modified Files:
src/bin/sh: sh.1
Log Message:
document OLDPWD and cd -
To generate a diff of this commit:
cvs rdiff -u -r1.99 -r1.100 src/bin/sh/sh.1
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/bin/sh/sh.1
diff -u src/bin/sh/sh.1:1.99 src/bin/sh/sh.1:1.100
--- src/bin/sh/sh.1:1.99 Wed Jun 2 22:05:02 2010
+++ src/bin/sh/sh.1 Sat Jun 11 10:37:36 2011
@@ -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