$PWD vs. pwd regarding portability

前端 未结 5 1216
孤独总比滥情好
孤独总比滥情好 2021-02-07 06:00

I\'m writing a shell script which parses the path of the current working directory (printing a like of all basenames above the current directory).

So far, I\'ve been usi

5条回答
  •  再見小時候
    2021-02-07 06:37

    From that forum article, "$PWD vs `pwd`" which compares AIX 4.2.1, AIX 6, Sparc Solaris 10 and Redhat 5 enterprise with this regard:

    • there is no difference between $PWD and builtin pwd,

    • there is no difference between builtin pwd -P and /usr/bin/pwd.

    The former shows working directory with names of symbolic links whereas the latter displays actual path.

    The only discrepancy is that external command is in /usr/bin in most systems and /bin in Redhat.

提交回复
热议问题