原文:shell提示符顯示git當前分支

編輯 etc profile或者 .bashrc 在行末添加如下內容 獲取git當前分支 git branch branch cd PWD if d .git then output git describe contains all HEAD tr s n if output then branch output fi fi echo branch linux IPADDRS sbin ifco ...

2014-03-03 20:54 0 2369 推薦指數:

查看詳情

Shell 提示符顯示 Git 分支名稱

| 導語 如果你是用命令行來使用Git的話,當在一個項目中頻繁使用多個分支時,可以使用 git status 命令查詢自己現在正工作在哪個分支下面,不過難免有腦子發昏的時候,忘記自己在哪個分支下面,因而發生誤操作之類的杯具。 那么把分支顯示Shell 提示符中無疑方便了很多,再也不需要頻繁 ...

Wed Sep 07 17:35:00 CST 2016 0 1896
linux shell 提示符

當我們打開或者登陸到一個終端的時候都會顯示一長串提示符 提示符一般包含當前登陸的用戶名 ,主機名,以及當前工作路徑路徑,最后都是以 $ 或者 # 號結束,普通用戶以 $ 號結束,只有root用戶以 #結束。 因為包含了當前工作路徑,所以當我們切換工作路徑的時候,提示符也是會變化 ...

Sun Jun 02 18:59:00 CST 2019 0 834
linux下shell顯示git當前分支

function git-branch-name { git symbolic-ref HEAD 2>/dev/null | cut -d"/" -f 3 } function git-branch-prompt { local branch=`git ...

Wed Nov 08 18:08:00 CST 2017 0 1604
Shell:命令提示符

Blog:博客園 個人 參考:命令提示符 目錄 概述 環境變量 PS1 顏色 環境變量 PS2,PS3,PS4 概述 用戶進入 Bash 以后,Bash 會顯示一個命令提示符,用來提示用戶在該位置后面輸入命令。 環境變量 PS1 ...

Tue Dec 15 16:44:00 CST 2020 0 390
Linux修改Shell命令提示符及顏色

Linux修改Shell命令提示符及顏色 1. Linux登錄過程中加載配置文件順序: /etc/profile → /etc/profile.d/*.sh → ~/.bash_profile → ~/.bashrc → [/etc/bashrc] 可查看默認 ...

Tue Nov 22 23:08:00 CST 2016 0 4345
Linux修改Shell命令提示符及顏色

1. Linux登錄過程中加載配置文件順序: /etc/profile → /etc/profile.d/*.sh → ~/.bash_profile → ~/.bashrc → [/etc/bashrc]可查看默認的~/.bashrc文件如下: 2. Shell命令提示符及顏色 ...

Mon Oct 02 00:18:00 CST 2017 0 8992
修改shell命令提示符和命令的輸入顏色

修改命令提示符顏色 修改命令提示符的話,只需修改PS1環境變量即可。 效果如圖: 修改命令輸入的顏色 修改命令輸入的顏色,思路是不關閉PS1的顏色,然后在每次敲下回車鍵執行命令的時候自動插入顏色終止。這需要借助trap捕獲DEBUG信號來實現。 如果要寫入shell ...

Sat Sep 21 20:45:00 CST 2019 0 388
Linux修改Shell命令提示符及顏色

//轉自http://www.linuxidc.com/Linux/2014-10/108195.htm Linux修改Shell命令提示符及顏色 1. Linux登錄過程中加載配置文件順序: /etc/profile → /etc/profile.d/*.sh ...

Sat Feb 18 19:14:00 CST 2017 0 1398
 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM