Changes
Jump to navigation
Jump to search
← Older edit
Newer edit →
Linux: Customize Shell Prompt
(edit)
Revision as of 08:43, 31 October 2018
85 bytes added
,
08:43, 31 October 2018
→With git branch and timestamp
Line 47:
Line 47:
=== With git branch and timestamp ===
=== With git branch and timestamp ===
−
<source lang="bash">PS1=\[\033[01;31m\]\t \[\033[01;32m\]durrantm \[\033[02;36m\]\h \[\033[01;34m\]`pwd | sed "s#\(/[^/]\{1,\}/[^/]\{1,\}/[^/]\{1,\}/\).*\(/[^/]\{1,\}/[^/]\{1,\}\)/\{0,1\}#\1_\2#g"` \[\033[00;33m\]$(git_branch)\[\033[00m\]\n\$ </source>
+
<source lang="bash">
git_branch () {
+
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/'
+
}
+
PS1=\[\033[01;31m\]\t \[\033[01;32m\]durrantm \[\033[02;36m\]\h \[\033[01;34m\]`pwd | sed "s#\(/[^/]\{1,\}/[^/]\{1,\}/[^/]\{1,\}/\).*\(/[^/]\{1,\}/[^/]\{1,\}\)/\{0,1\}#\1_\2#g"` \[\033[00;33m\]$(git_branch)\[\033[00m\]\n\$ </source>
== Green prompt with timestamp ==
== Green prompt with timestamp ==
Rafahsolis
Bureaucrats
,
Administrators
2,306
edits
Navigation menu
Personal tools
Not logged in
Talk
Contributions
Create account
Log in
Namespaces
Page
Discussion
Variants
Views
Read
Edit
View history
More
Search
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Tools
Special pages
Printable version