87fdb9975d800c64a8bdc812d7182302fac8a2e0
1 # Bash initialization for interactive non-login shells and
2 # for remote shells (info "(bash) Bash Startup Files").
4 # Export 'SHELL' to child processes. Programs such as 'screen'
5 # honor it and otherwise use /bin/sh.
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
15 # Don't do anything else.
19 if [ -n "$IS_GUIX_SYSTEM" ]; then
20 # Source the system-wide file.
27 if [ -z "${debian_chroot:-}" ] && [ -r /etc
/debian_chroot
]; then
28 debian_chroot
=$
(cat /etc
/debian_chroot
)
34 local TITLEBAR
="\[\033]0;${debian_chroot:+($debian_chroot) }\h:\w\007\]"
42 $([ $(id -u) = "0" ] && printf "\
[\e
[1;31m\
]")\
43 : ${debian_chroot:+($debian_chroot) }\
45 $([ -n "$GUIX_ENVIRONMENT" ] && printf " [env
]")\
47 $([ $(id -u) = "0" ] && printf "\
[\e
[00m\
]")\
55 # i-beam cursor (uncomment one of the two):
56 # echo -e "\033[5 q" # blinking
57 # echo -e "\033[6 q" # non-blinking
59 # general configuration and completions
60 # -------------------------------------
62 # disallow overwriting existing file using redirection
64 # append to the history file, don't overwrite it
67 # check the window size after each command and, if necessary,
68 # update the values of LINES and COLUMNS.
70 # If set, the pattern "**" used in a pathname expansion context will
71 # match all files and zero or more directories and subdirectories.
73 # for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
76 # don't put duplicate lines or lines starting with space in the
78 HISTCONTROL
=ignoreboth
79 # ignore a few very common commands and don't add them to history
80 #HISTIGNORE='ls:l:ll:s:g:[bf]g:history:da:li'
81 HISTTIMEFORMAT
='%F %T '
84 # make less more friendly for non-text input files, see lesspipe(1)
85 [ -x /usr
/bin
/lesspipe
] && eval "$(SHELL=/bin/sh lesspipe)"
87 export GCC_COLORS
='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'
89 # enable programmable completion features (not needed if already
90 # enabled in /etc/bash.bashrc and if /etc/profile sources
92 if ! shopt -oq posix
; then
93 if [ -f /usr
/share
/bash-completion
/bash_completion
]; then
94 .
/usr
/share
/bash-completion
/bash_completion
95 elif [ -f /etc
/bash_completion
]; then
96 .
/etc
/bash_completion
100 # source Guix shell config dirs, for vte.sh and bash completions
101 GUIX_PROFILES
=("${HOME}/.guix-profile"
102 "${HOME}/.config/guix/current")
103 for profile
in "${GUIX_PROFILES[@]}"; do
104 for dir
in "${profile}/etc/bash_completion.d" "${profile}/etc/profile.d"; do
105 if [ -d "${dir}" ]; then
106 for f
in "${dir}"/*; do
113 # aliases and functions
114 # ---------------------
116 if [ -f ~
/.bash_aliases
]; then
120 alias ls='ls --color=auto'
121 alias l
='ls -Flh' # long format and human-readable sizes
122 alias ll
='l -a' # long format, all files
123 alias dir
='dir --color=auto'
124 alias vdir='vdir --color=auto'
125 alias grep='grep --color=auto'
126 alias egrep='grep -E --color=auto'
127 alias fgrep
='grep -F --color=auto'
128 alias mpv
="mpv --ytdl-format=mp4"
131 alias mbsync
='mbsync -c "$XDG_CONFIG_HOME"/isync/mbsyncrc'
132 alias getmail
='getmail --getmaildir "$XDG_CONFIG_HOME"/getmail --rcfile getmailrc'
133 alias m
="mbsync csclub; mbsync kelar; mbsync shemshak; mbsync gnub; getmail"
135 alias se
="SUDO_EDITOR=\"emacsclient\" sudo -e"
137 alias alert
='notify-send --urgency=low \
138 -i "$([ $? = 0 ] && echo terminal || echo error)" \
139 "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"'
141 alias da
='change-theme dark'
142 alias li
='change-theme light'
144 alias dquilt
="quilt --quiltrc=${XDG_CONFIG_HOME}/quilt/quiltrc-dpkg"
145 .
/usr
/share
/bash-completion
/completions
/quilt
146 complete
-F _quilt_completion
-o filenames dquilt
149 cd $
(mktemp
-d /tmp
/$1.XXXX
)