-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.bashrc__centos
More file actions
110 lines (94 loc) · 3.5 KB
/
.bashrc__centos
File metadata and controls
110 lines (94 loc) · 3.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
# .bashrc
# switch shell language to english to see english e.g. error messages
LANGUAGE=en_US.UTF-8
LANG=en_US.UTF-8
LC_MESSAGES=en_US.UTF-8
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
# don't put duplicate lines or lines starting with space in the history file
# and erase all older occurences of a command from history
# See bash(1) for more options
HISTCONTROL=ignoreboth
# append to the history file, don't overwrite it
shopt -s histappend
# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
HISTSIZE=1000000
HISTFILESIZE=1000000
# add timestamp to command history
HISTTIMEFORMAT="| %Y-%m-%d %T | "
# Uncomment the following line if you don't like systemctl's auto-paging feature:
# export SYSTEMD_PAGER=
umask 027
# get general aliases and exports from separate file
if [ -f ~/.bash_aliases ]; then
. ~/.bash_aliases
fi
if [ -f ~/.bash_aliases_local ]; then
source ~/.bash_aliases_local
else
echo "# Add your locally used aliases (not contained in .bash_aliases) here" > ~/.bash_aliases_local
echo "" >> ~/.bash_aliases_local
fi
# Add multiple directories from home directory to PATH
# Array of directories to add (relative to $HOME)
declare -a PATH_DIRS=(
"$HOME/bin"
"$HOME/.local/bin"
"$HOME/dotfiles/bin-extend"
)
# Loop through array and add to PATH if directory exists and not already in PATH
for dir in "${PATH_DIRS[@]}"; do
if [ -d "$dir" ]; then
# Check if directory is not already in PATH
case ":$PATH:" in
*:"$dir":*)
# Directory already in PATH, skip
;;
*)
# Directory not in PATH, add it
PATH="$PATH:$dir"
;;
esac
fi
done
# disable Software Flow Control (XON/XOFF flow control)
# this e.g. prevents vim from splitting from CtrlP-Plugin using CTRL+S
# for details see: http://unix.stackexchange.com/questions/72086/ctrl-s-hang-terminal-emulator
# but for interactive shells only (http://stackoverflow.com/questions/24623021/getting-stty-standard-input-inappropriate-ioctl-for-device-when-using-scp-thro
# and http://unix.stackexchange.com/questions/26676/how-to-check-if-a-shell-is-login-interactive-batch)
# e.g. preventing errors around “stty: standard input: Inappropriate ioctl for device” on shell scripts using ssh connection
if [[ $- == *i* ]]; then
stty -ixon
# check if liquidprompt is installed
if [ -d /usr/share/liquidprompt ]; then
# installed via apt-get
echo "Using system installed liquidprompt."
source /usr/share/liquidprompt/liquidprompt
elif [ -d ~/.mybash/liquidprompt ]; then
# Only load Liquid Prompt in interactive shells, not from a script or from scp
# local version (git) is used
echo "Using liquidprompt from git."
source ~/.mybash/liquidprompt/liquidprompt
fi
# file to extend the (git) standard .bashrc by stuff needed only on certain profiles
ADDONFILE="$HOME/bin/bashrc_addon.sh"
if [ -f $ADDONFILE ]; then
$ADDONFILE
fi
# show content of the memofile if exists and size is greater than zero
MEMOFILE="$HOME/.memo_bashrc"
if [ -f $MEMOFILE ]; then
if [ $(stat --printf="%s" $MEMOFILE) -gt 0 ]; then
echo
echo "--- MEMO -------------------------------"
cat $MEMOFILE
echo "----------------------------------------"
echo
fi
else
touch $MEMOFILE
fi
date -Is > ~/.last_interactive_login
fi