Line | |
---|
1 | # Bash initialization for interactive non-login shells and
|
---|
2 | # for remote shells (info "(bash) Bash Startup Files").
|
---|
3 |
|
---|
4 | # Export 'SHELL' to child processes. Programs such as 'screen'
|
---|
5 | # honor it and otherwise use /bin/sh.
|
---|
6 | export SHELL
|
---|
7 |
|
---|
8 | if [[ $- != *i* ]]
|
---|
9 | then
|
---|
10 | # We are being invoked from a non-interactive shell. If this
|
---|
11 | # is an SSH session (as in "ssh host command"), source
|
---|
12 | # /etc/profile so we get PATH and other essential variables.
|
---|
13 | [[ -n "$SSH_CLIENT" ]] && source /etc/profile
|
---|
14 |
|
---|
15 | # Don't do anything else.
|
---|
16 | return
|
---|
17 | fi
|
---|
18 |
|
---|
19 | # Source the system-wide file.
|
---|
20 | source /etc/bashrc
|
---|
21 |
|
---|
22 | function color_prompt {
|
---|
23 | local __user_and_host="\[\033[01;35m\]@\u"
|
---|
24 | local __cur_location="\[\033[01;34m\]\w"
|
---|
25 | local __git_branch_color="\[\033[01;36m\]"
|
---|
26 | #local __git_branch="\`ruby -e \"print (%x{git branch 2> /dev/null}.grep(/^\*/).first || '').gsub(/^\* (.+)$/, '(\1) ')\"\`"
|
---|
27 | local __git_branch='`git branch 2> /dev/null | grep -e ^* | sed -E s/^\\\\\*\ \(.+\)$/\(\\\\\1\)\ /`'
|
---|
28 | local __prompt_tail="\[\033[30m\]$"
|
---|
29 | local __last_color="\[\033[00m\]"
|
---|
30 | export PS1="$__user_and_host $__cur_location $__git_branch_color$__git_branch$__prompt_tail$__last_color "
|
---|
31 | }
|
---|
32 |
|
---|
33 | # Adjust the prompt depending on whether we're in 'guix environment'.
|
---|
34 | if [ -n "$GUIX_ENVIRONMENT" ]
|
---|
35 | then
|
---|
36 | PS1='\u@\h \w [env]\$ '
|
---|
37 | else
|
---|
38 | PS1='\u \w\$ '
|
---|
39 | color_prompt
|
---|
40 | fi
|
---|
Note:
See
TracBrowser
for help on using the repository browser.