source: dotfiles/guix/.bashrc@ 2d81e69

Last change on this file since 2d81e69 was 2d81e69, checked in by Mikhail Kirillov <w96k@…>, on Mar 7, 2020 at 2:08:41 AM

Add ps1 customization; Add wayland vars;

  • Property mode set to 100644
File size: 1.3 KB
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.
6export SHELL
7
8if [[ $- != *i* ]]
9then
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
17fi
18
19# Source the system-wide file.
20source /etc/bashrc
21
22function 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'.
34if [ -n "$GUIX_ENVIRONMENT" ]
35then
36 PS1='\u@\h \w [env]\$ '
37else
38 PS1='\u \w\$ '
39 color_prompt
40fi
Note: See TracBrowser for help on using the repository browser.