-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.bashrc_os
34 lines (22 loc) · 1015 Bytes
/
.bashrc_os
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
#----- header -----
[ "${0##*/}" != "${BASH_SOURCE##*/}" ] || { >&2 echo -e "ERROR\tfile must be sourced ($0)"; return 2; }
# prevent multiple-inclusion
__link=`readlink -f "$BASH_SOURCE"`
declare -n __tag=SOURCE_${__link//[^a-zA-Z0-9_]/}
[ ${__tag:-0} -eq 0 ] || return 0
#------------------
#NOTE - Mingw/MSYS don't support symlinks! The resulting file has just
# a sigle line in it with the link target, which when sourced'd tries to
# execute the file, which is an error.
: ${OSTYPE:=`uname -o | cut -d _ -f 1 | tr '[:upper:]' '[:lower:]'`}
__tag=1
__uname=`uname` # alt: uname|sed -E 's/(-[0-9.]+)+$//'
for f in "${BASH_SOURCE/bashrc/functions}" "${BASH_SOURCE}".{$OSTYPE,${__uname%%-*}}; do
[ -s "$f" ] || continue
source "$f" || { log.error "RC=$? during $f"; return; }
done
is_exec -q tree{,.com} || { is_function os.tree && alias tree='os.tree'; }
#TODO activate .functions_os first
#declare -F os.file.replace && alias replace_file='os.file.replace'
#os.detect
# vim: expandtab:ts=4:sw=4