-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.bashrc_os.Linux
More file actions
32 lines (24 loc) · 804 Bytes
/
.bashrc_os.Linux
File metadata and controls
32 lines (24 loc) · 804 Bytes
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
#----- 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
__tag=1
#------------------
# ignore if wrong OS
_flavor=${BASH_SOURCE##*/}
_flavor=${_flavor#?*.}
[[ "${OSTYPE:-`uname`}" =~ "${_flavor:-unknown}" ]] || return 0
[ `id -u` -eq 0 ] || : ${SUDO:=sudo}
[ `ps -p 1 -o comm= 2>/dev/null` != 'systemd' ]
SYSTEMD=$?
is_exec -q pidof ||
function pidof() {
\ps -o pid,cmd | awk -v pat="$1" '$NF ~ pat { print $1 }'
}
for f in "${BASH_SOURCE/bashrc/functions}"; do
[ -f "$f" ] || continue
source "$f" || { log.error "RC=$? during $f"; return; }
done
# vim: expandtab:ts=4:sw=4