daa4d00719912261991f8c6a42f2771c1d4e14b8
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)
29 # Adjust the prompt depending on whether we're in 'guix environment'.
30 if [ -n "$GUIX_ENVIRONMENT" ]
32 PS1
="\u@\h [env] \$(a_prompt)> "
34 PS1
="\u@\h \$(a_prompt)> "
38 # echo -e "\033[5 q" # blinking
39 # echo -e "\033[6 q" # non-blinking
42 # append to the history file, don't overwrite it
45 # check the window size after each command and, if necessary,
46 # update the values of LINES and COLUMNS.
48 # If set, the pattern "**" used in a pathname expansion context will
49 # match all files and zero or more directories and subdirectories.
51 # for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
54 # don't put duplicate lines or lines starting with space in the
56 HISTCONTROL
=ignoreboth
57 # ignore a few very common commands and don't add them to history
58 HISTIGNORE
='ls:l:s:g:[bf]g:history'
59 HISTTIMEFORMAT
='%F %T '
63 alias ls='ls -p --color=auto'
64 alias l
='ls -lh' # long format and human-readable sizes
65 alias ll
='l -A' # long format, all files
66 alias dir
='dir --color=auto'
67 alias vdir='vdir --color=auto'
68 alias grep='grep --color=auto'
69 alias fgrep
='fgrep --color=auto'
70 alias egrep='egrep --color=auto'
71 alias mpv
="mpv --ytdl-format mp4"
74 alias mbsync
='mbsync -c "$XDG_CONFIG_HOME"/isync/mbsyncrc'
75 alias getmail
='getmail --getmaildir "$XDG_CONFIG_HOME"/getmail --rcfile getmailrc'
76 alias m
="mbsync csclub; mbsync uwaterloo; mbsync shemshak; mbsync gnub"
77 alias best
="youtube-dl -f best"
79 alias se
="SUDO_EDITOR=\"emacsclient\" sudo -e"
83 [ -d ${1} ] || git clone https
://aur.archlinux.org
/${1}.git
87 # separate alias definitions file, if exists
88 if [ -f ~
/.bash_aliases
]; then
92 # enable programmable completion features (not needed if already
93 # enabled in /etc/bash.bashrc and if /etc/profile sources
95 if ! shopt -oq posix
; then
96 if [ -f /usr
/share
/bash-completion
/bash_completion
]; then
97 .
/usr
/share
/bash-completion
/bash_completion
98 elif [ -f /etc
/bash_completion
]; then
99 .
/etc
/bash_completion
103 if [ -z "$IS_GUIX_SYSTEM" ]; then
104 if ! pgrep
-u "$USER" ssh-agent
> /dev
/null
; then
105 ssh-agent
> ~
/.ssh-agent-thing
107 if [[ ! "$SSH_AUTH_SOCK" ]]; then
108 eval "$(<~/.ssh-agent-thing)"