Comments (4)
there are the code HalloweenBash generate:
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}
export PS1="\h:\W \u\$(parse_git_branch)$ "
from halloweenbash.
Hi @atupal,
I apologize, but I don't understand your question. It's possible your environment has different dependencies which you may need to include.
As I understand my code, it shows you the current git branch if your current directory uses git. You get no git branch information if your current directory does not use git.
Let me know if you have any questions.
Thanks,
-Rex
from halloweenbash.
I find the problem in my code:
Because I use the follow code:
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}
git_branch=" \[\e[0;33m\]$(parse_git_branch)\[\e[m\] "
export PS1="\h:\W \u\$git_branch$ "
so after I source .bashrc
the $git_branch
become a fixed string but not raw string after initial. (because i use the "
);
And it work after I change the "
to'
;
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}
git_branch=' \[\e[0;33m\]$(parse_git_branch)\[\e[m\] '
export PS1="\h:\W \u\ $git_branch$ "
thx! I am sorry for my careless ...
from halloweenbash.
@atupal Great, glad it works!
from halloweenbash.
Related Issues (16)
- Support current git branch
- Offer a way to remove components from configuration HOT 3
- Removing everything from 'Your Configuration' is irreversible
- Advise to start with ': ' first and end with '; ' -- helps cut-n-paste HOT 1
- Allow color switching intra-PS1 HOT 10
- The orange makes my eyes bleed HOT 1
- Escape $ so it becomes # after switching to root HOT 3
- Git Branch Colors HOT 2
- Core Temperature -> Linux / Mac HOT 2
- Free RAM -> Linux/Mac HOT 8
- Space disappears after being dragged HOT 9
- Could do with an @ sign as an available symbol
- Lacks exit status of previous command HOT 5
- Character and colours HOT 1
- Last command exit status HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from halloweenbash.