
我一直認為「過去」對 pwd 的提及是非常重要的。如今,我們已經自訂了像 PS1 這樣顯示目前目錄的命令提示符,而 pwd 已經相當過時了。但是 ps1 的想法是什麼時候被引入 *nix 系統的呢?觀看這從AT&T的檔案中我可以看出PS1在七十年代絕對不存在。
答案1
該變數是 shell 的一部分,在Bourne shell ( ) 和 中$PS1
使用,但在.bash
sh
ksh
csh
第一個 UNIX shell 是 Thompson Shell(也稱為sh
像後來的 bourne shell,Thompson Shell 通常osh
在同時安裝了 Thompson 和 Bourne shell 的系統上呼叫。) Thompson shell 使用該變數$P
作為提示符。
然後引入了 Bourne Shell,用於$PS1
設定提示符。ksh
基於 Bourne Shell,也使用$PS1
.使用csh
過的。tcsh
set prompt = <something>
所以我認為第一個使用的 shell$PS1
是 Bourne Shell。
湯普森貝殼手冊頁:https://etsh.io/man/osh.1.pdf
Bourne Shell 手冊頁:http://heirloom.sourceforge.net/sh/sh.1.html