-
Notifications
You must be signed in to change notification settings - Fork 0
/
.bashrc-common
55 lines (43 loc) · 1.29 KB
/
.bashrc-common
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
# Multi-line grep allowing one or more white spaces between words
mgrep()
{
PATTERN=""
for ((i=1; i<=$#; i++)); do
#printf "[%s]\n" ${!i}
if [ "$i" -ne "1" ]; then
PATTERN+="(\s)+"
fi
PATTERN+=${!i}
done
#printf "[%s]\n" $PATTERN
pcregrep --color -niM "$PATTERN" *
# Getting n-th argument:
# http://stackoverflow.com/questions/1497811/how-to-get-the-nth-positional-argument-in-bash
# Getting the last argument:
# http://stackoverflow.com/questions/1853946/getting-the-last-argument-passed-to-a-shell-script
}
# -a: include . files
# -h: use unit suffixes
# -l: long format
# -t: most recently modified first
# -G: colorized output
alias ll='ls -ahltG'
# -i: request confirmation
alias rm='rm -i'
# -C: always colorize
alias tree='tree -C'
# -R: colorize
alias less='less -R'
# Print timestamp in history [https://askubuntu.com/a/391087]
HISTTIMEFORMAT="%F %T "
# Starship
eval "$(starship init bash)"
# https://starship.rs/faq/#why-don-t-i-see-a-glyph-symbol-in-my-prompt
export LC_ALL="en_US.UTF-8"
# Colorize jq output even when it's outputting to pipe
alias jq='jq -C'
SCRIPT_PATH=$(dirname $(realpath ${BASH_SOURCE}))
alias cdsettings='cd ${SCRIPT_PATH}'
alias tf='terraform'
# TODO: Add automatically opening the web link
alias gitpush='git push origin `git branch --show-current`'