Johannes Sixt <j.s...@viscovery.net> writes:
> That said, it is not wrong to use $(pwd) with test_set_editor, it's just
> unnecessarily slow.
Any shell that knows $(...) is pretty sure to have pwd as a built-in.
I don't think Git will run on those kind of ancient shells reverting to
The autoconf manual (info "(autoconf) Limitations of Builtins") states
With modern shells, plain 'pwd' outputs a "logical" directory name,
some of whose components may be symbolic links. These directory
names are in contrast to "physical" directory names, whose
components are all directories.
Posix 1003.1-2001 requires that 'pwd' must support the '-L'
("logical") and '-P' ("physical") options, with '-L' being the
default. However, traditional shells do not support these options,
and their 'pwd' command has the '-P' behavior.
Portable scripts should assume neither option is supported, and
should assume neither behavior is the default. Also, on many hosts
'/bin/pwd' is equivalent to 'pwd -P', but Posix does not require
this behavior and portable scripts should not rely on it.
Typically it's best to use plain 'pwd'. On modern hosts this
outputs logical directory names, which have the following
* Logical names are what the user specified.
* Physical names may not be portable from one installation host
to another due to network file system gymnastics.
* On modern hosts 'pwd -P' may fail due to lack of permissions
to some parent directory, but plain 'pwd' cannot fail for this
Also please see the discussion of the 'cd' command.
So $PWD is pretty much guaranteed to be the same as $(pwd) and pretty
much guaranteed to _not_ be "unnecessarily slow" when not run in an
However, looking at (info "(autoconf) Special Shell Variables") I see
Posix 1003.1-2001 requires that 'cd' and 'pwd' must update the
'PWD' environment variable to point to the logical name of the
current directory, but traditional shells do not support this.
This can cause confusion if one shell instance maintains 'PWD' but
a subsidiary and different shell does not know about 'PWD' and
executes 'cd'; in this case 'PWD' points to the wrong directory.
Use '`pwd`' rather than '$PWD'.
Ok, probably Git relies on Posix 1003.1-2001 in other respects so it's
likely not much of an actual issue.
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html