$PWD vs. pwd regarding portability

前端 未结 5 1231
孤独总比滥情好
孤独总比滥情好 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条回答
  •  猫巷女王i
    2021-02-07 06:42

    If you know that bash is available and the script is executed with it, PWD is safe.

    If, on some systems, only plain sh is available, use pwd.

提交回复
热议问题