-
Notifications
You must be signed in to change notification settings - Fork 6
/
system
48 lines (39 loc) · 1.12 KB
/
system
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
#!/bin/bash
source ~/.bash/functions
ALIASES_D=~/.bash/aliases.d
PROFILE_D=~/.bash/profile.d
CUSTOM_ALIASES_D=~/.bash.aliases.d
CUSTOM_PROFILE_D=~/.bash.profile.d
# Loading default profiles and aliases
source_directories $ALIASES_D $PROFILE_D
# Loading custom profiles and aliases
source_directories $CUSTOM_ALIASES_D $CUSTOM_PROFILE_D
function reload() {
unregister_aliases
if [ -e ~/.bashrc ]; then
source ~/.bashrc
elif [ -e ~/.bash_profile ]; then
source ~/.bash_profile
else
source ~/.bash/system
fi
}
function enable-aliases() {
local _aliases_name=$1
local _directories=($ALIASES_D $CUSTOM_ALIASES_D)
for _directory in ${_directories[@]}; do
if [ -f $_directory/$_aliases_name ]; then
chmod +x $_directory/$_aliases_name
source $_directory/$_aliases_name
fi
done
}
function disable-aliases() {
local _aliases_name=$1
local _directories=($ALIASES_D $CUSTOM_ALIASES_D)
for dir in ${_directories[@]}; do
if [ -f $_directory/$_aliases_name ]; then
chmod -x $_directory/$_aliases_name
fi
done
}