b38f7eacb95a76d2f570a4cb50f94139e234361f
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.
24 # from https://unix.stackexchange.com/a/55935
26 cwd
=$
(sed -e "s:$HOME:~:" -e "s:\(\.\?[^/]\)[^/]*/:\1/:g" <<<$PWD)
30 if [ $
(id
-u) == "0" ]; then
31 PS1
='`printf "\[\e[1;31m\]\$\[\e[00m\]"` '
35 PS1
="\u@\h:\w/`[ -n "$GUIX_ENVIRONMENT" ] && printf \" [env]\"`\n$PS1"
38 PROMPT_COMMAND
='echo -ne "\033]0;${USER}@${HOSTNAME}: $(b_prompt)\007"'
41 # echo -e "\033[5 q" # blinking
42 echo -e "\033[6 q" # non-blinking
45 # append to the history file, don't overwrite it
48 # check the window size after each command and, if necessary,
49 # update the values of LINES and COLUMNS.
51 # If set, the pattern "**" used in a pathname expansion context will
52 # match all files and zero or more directories and subdirectories.
54 # for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
57 # don't put duplicate lines or lines starting with space in the
59 HISTCONTROL
=ignoreboth
60 # ignore a few very common commands and don't add them to history
61 HISTIGNORE
='ls:l:s:g:[bf]g:history'
62 HISTTIMEFORMAT
='%F %T '
66 alias ls='ls -p --color=auto'
67 alias l
='ls -lh' # long format and human-readable sizes
68 alias ll
='l -A' # long format, all files
69 alias dir
='dir --color=auto'
70 alias vdir='vdir --color=auto'
71 alias grep='grep --color=auto'
72 alias fgrep
='fgrep --color=auto'
73 alias egrep='egrep --color=auto'
74 alias mpv
="mpv --ytdl-format mp4"
77 alias mbsync
='mbsync -c "$XDG_CONFIG_HOME"/isync/mbsyncrc'
78 alias getmail
='getmail --getmaildir "$XDG_CONFIG_HOME"/getmail --rcfile getmailrc'
79 alias m
="mbsync csclub; mbsync uwaterloo; mbsync shemshak; mbsync gnub"
80 alias best
="youtube-dl -f best"
82 alias se
="SUDO_EDITOR=\"emacsclient\" sudo -e"
86 [ -d ${1} ] || git clone https
://aur.archlinux.org
/${1}.git
91 cd $
(mktemp
-d /tmp
/$1.XXXX
)
94 # separate alias definitions file, if exists
95 if [ -f ~
/.bash_aliases
]; then
99 # enable programmable completion features (not needed if already
100 # enabled in /etc/bash.bashrc and if /etc/profile sources
102 if ! shopt -oq posix
; then
103 if [ -f /usr
/share
/bash-completion
/bash_completion
]; then
104 .
/usr
/share
/bash-completion
/bash_completion
105 elif [ -f /etc
/bash_completion
]; then
106 .
/etc
/bash_completion