-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathfunctions
42 lines (34 loc) · 1.23 KB
/
functions
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
#!/usr/bin/env bash
#==============================================================================
#
# FILE: functions
# USAGE: . functions
# DESCRIPTION: Sets application-wide functions
#
# OPTIONS: ---
# REQUIREMENTS: ---
# BUGS: ---
# NOTES: ---
# AUTHOR: Kevin Huntly <kmhuntly@gmail.com>
# COMPANY: ---
# VERSION: 1.0
# CREATED: ---
# REVISION: ---
#
#==============================================================================
## load functions
for file_entry in "${HOME}"/.functions.d/*; do
[[ -z "${file_entry}" ]] && continue;
if [[ -d "${file_entry}" ]]; then
for dir_entry in "${file_entry}"/*; do
[[ -z "${dir_entry}" ]] && continue;
if [[ -r "${dir_entry}" ]] && [[ -s "${dir_entry}" ]]; then source "${dir_entry}"; fi
[[ -n "${dir_entry}" ]] && unset -v dir_entry;
done
[[ -n "${dir_entry}" ]] && unset -v dir_entry;
[[ -n "${file_entry}" ]] && unset -v file_entry;
fi
if [[ -r "${file_entry}" ]] && [[ -s "${file_entry}" ]]; then source "${file_entry}"; fi
[[ -n "${dir_entry}" ]] && unset -v dir_entry;
[[ -n "${file_entry}" ]] && unset -v file_entry;
done