Manoj Srivastava <[EMAIL PROTECTED]> writes: > So, what is the provenance of this CURDIR variable? Has it > been blessed by POSIX? indeed not. However, I see that both $PWD and > the pwd utility are sanctioned by POSIX; so for maximal portability > scripts should *NOT* use CURDIR, the should either use PWD, or call > pwd themselves, like the example did.
The days when running "pwd" was moderately expensive are long past, and since PWD can be wrong sometimes, I would suggest every script that wants the anwser should use "pwd". Shell script programming is *hard*, because even that is not often what you want. A shell script should normally continue to work right if parent directories are changed; converting things to absolute paths and then using that is frequently a source of gratuitous bugs in this area. Thomas