-
Notifications
You must be signed in to change notification settings - Fork 1
/
bash_aliases
105 lines (90 loc) · 1.67 KB
/
bash_aliases
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
# .bash_aliases -*- mode: shell-script -*-
alias ll='ls -l'
alias la='ls -A'
alias lc='ls -CF'
export TIME_STYLE='posix-long-iso'
# gnu diff does not have DIFFOPTIONS like FreeBSD so:
alias diff='diff -u'
alias reb='find . -name \*~ -print -delete'
export LESS="-iR"
if which eie > /dev/null 2>&1
then
alias edit="eie --no-frame"
alias ed="eie --no-wait"
export EDITOR="eie"
elif which mg > /dev/null 2>&1
then
alias edit="mg"
alias ed="mg"
export EDITOR="mg"
elif which jove > /dev/null 2>&1
then
alias edit="jove"
alias ed="jove"
export EDITOR="jove"
fi
# give lynx a custom configuration
alias lynx='lynx -nopause'
# this is a quick fix for roxterm tab names
if [ -n "${ROXTERM_ID}" -a -z "${PROMPT_COMMAND}" ]
then
cd
PROMPT_COMMAND='echo -ne "\033]0;${PWD/${HOME}/~}\007"'
fi
mkcd()
{
local dir
dir="$1"; shift
if [ -z "${dir}" ]
then
pwd
elif [ -d "${dir}" ]
then
cd "${dir}"
elif [ -f "${dir}" ]
then
echo A file of that name already exists
return 1
else
mkdir -p "${dir}"
cd "${dir}"
fi
return 0
}
# remove items from PATH
pathrm()
{
local item pa p IFS old_ifs
old_ifs="${IFS}"
IFS=':'
pa=(${PATH})
IFS="${old_ifs}"
for item in $@
do
pa=("${pa[@]/${item}/}")
done
p=
for item in "${pa[@]}"
do
[ -n "${item}" ] && p="${p}:${item}"
done
pa="${pa[@]}"
PATH="${p:1}"
}
# add items to front of PATH
# move existing items to front of PATH
pathfront()
{
local item p
pathrm "$@"
p=
for item in $@
do
[ -n "${item}" ] && p="${p}:${item}"
done
PATH="${p:1}:${PATH}"
}
# include machine specific aliases
if [ -f ~/.bash_aliases_extra ]; then
. ~/.bash_aliases_extra
fi