2013-04-08 169 views
1

是否有可能使我的終端路徑更短?如何縮短Mac Terminal的路徑?

是否有可能使它只顯示當前目錄?

+0

這裏是如何做到這一點在bash: HTTP ://superuser.com/questions/60555/show-only-current-directory-name-not-full-path-on-bash-prompt – Gricha 2013-04-08 18:49:33

回答

3

在終端

export PS1='\W$ ' 
+0

在我繼續之前,有一種方式可以回來嗎? – 2013-04-08 18:54:31

+0

這是暫時的,您可以關閉終端。讓它堅持把你的'〜/ .profile'文件添加到你的行中。原來的PS1是'PS1 ='\ h:\ W \ u \ $'' – epatel 2013-04-08 18:56:47

2

變量PS1定義你的路徑查找試試這個。

例如:

export PS1="\[email protected]\h \w> " 

[email protected] /full/path/to/directory> 

    export PS1="\[email protected]\h \W> " 

[email protected] directory> 

現在你也可以做

export PS1="\[email protected]\h [\$(Some command with output)]> " 

你將不得不編輯你的〜/ .bash_profile。所以它在啓動時加載。 從而把出口PS1=....在.bash_profile中

重啓終端將恢復所有編輯,所以這就是爲什麼你把它放到〜/ .bash_profile中