-
Notifications
You must be signed in to change notification settings - Fork 1
/
_bashrc
98 lines (85 loc) · 1.61 KB
/
_bashrc
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
# -*- mode: sh -*-
# .bashrc
#
# $Id: .bashrc,v 1.1 2004/05/03 15:40:00 roth Exp $
#
# Created by Ted Roth
#
# User specific aliases and functions
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
# Source the debian supplied user .bashrc file
if [ -f ~/.bashrc-debian ]; then
. ~/.bashrc-debian
fi
# aliases for bash shell
alias ls='ls -F --color=auto'
alias la='ls -a'
alias l='ls -lh'
alias lc='ls -al'
alias rm='rm -i'
alias cp='cp -i'
alias env='env | sort'
# Show an image in a kitty terminal
# See: https://sw.kovidgoyal.net/kitty/kittens/icat/
icat ()
{
kitty +kitten icat "${@}"
}
path ()
{
echo "${PATH//:/$'\n'}"
}
# Function to add a dir to the end of PATH unless arg2 is "front"
addpath ()
{
if [ -n $1 ]
then
if ! echo $PATH | /bin/egrep -q "(^|:)$1($|:)"
then
if [ "$2" = "front" ]; then
PATH=$1:${PATH}
else
PATH=${PATH}:$1
fi
export PATH
echo "PATH is now:"
echo $PATH
fi
fi
}
add_ldpath ()
{
if [ -n $1 ]
then
if ! echo $LD_LIBRARY_PATH | /bin/egrep -q "(^|:)$1($|:)"
then
if [ "$2" = "front" ]; then
LD_LIBRARY_PATH=$1:${LD_LIBRARY_PATH}
else
LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:$1
fi
export LD_LIBRARY_PATH
fi
fi
}
rmpath ()
{
if [ -x $HOME/bin/rmpath.py ]
then
# If no args given , then rmpath.py will just remove duplicity
# from PATH and will always remove '.'.
PATH=$($HOME/bin/rmpath.py $@)
export PATH
echo "PATH is now:"
echo $PATH
fi
}
# call rmpath to clean up PATH variable
rmpath >/dev/null 2>&1
# Source the debian supplied user .bashrc file
if [ -f ~/.bashrc.local ]; then
. ~/.bashrc.local
fi