-
Notifications
You must be signed in to change notification settings - Fork 0
/
_main
66 lines (51 loc) · 1.95 KB
/
_main
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
#! /hint/sh
export B;B=${B:-$HOME/.config/bash/bashrc.d}
#unalias -a # for now not a problem
# SHELL DETECTION:
sh_is=${BASH_VERSION+bash}${KSH_VERSION+ksh}${NETBSD_SHELL+netbsd}${POSH_VERSION+posh}${SH_VERSION+sh}${YASH_VERSION+yash}${ZSH_VERSION+zsh}${BB_ASH_VERSION+bb_ash}
sh_is=${sh_is:-${0##*/}}; sh_is=${sh_is#-} # $0='-sh' when login shells
unset sh_is_bash sh_is_zsh sh_is_ash sh_is_sh sh_isin_cmd
case $sh_is in
bash|rbash) sh_is_bash='';;
zsh) sh_is_zsh='';;
ash|bb_ash) sh_is_ash='';;
*) sh_is_sh=''
case ${sh_is:-${0##*/}} in
dash|sh|mksh) ;;
\$|\$.sh) sh_isin_cmd=''; PS1='';;
ksh|netbsd|posh|yash) printf %s\\n >&2 "$B/_main: note, you are using shell that is not yet well tested";;
_main|_main.sh) printf %s\\n >&2 "$B/_main: shell not detected! \$0 seems to be '_main'?";;
*) printf %s\\n >&2 "$B/_main: unrecognized shell, assuming sh"; BB=$BB${BB:+:}nologin;;
esac
;;
esac
# todo: but what if is not in .config ? and then we have no $XDG_CONFIG_HOME ..
# check what wiki says in this case.
[ -e ~/.config/user-dirs.dirs ] && . "$B"/_homedir-vars
# big dot / "BULLET" (U+2022) -> alias •=source_all :
. "$B"/_U+2022•
• \
"$B"/_PATH \
"$B"/_env \
"$B"/_core \
"$B"/_fallback/FALLBACK \
"$B"/[a-z]*[!\~\!\@\#\$%^\&\*] \
;
sh_is_=${sh_is_bash+bash}${sh_is_zsh+zsh}${sh_is_ash+sh}${sh_is_sh+sh} # note ash runs *.sh files
• \
"$B"/%[a-z]*."$sh_is_" \
"$B"/_loadable/LOADABLE \
"$B"/a \
;
# detect if we are home:
case ${USER-}:${HOSTNAME-} in arcowo:kpc)
. "$B"/__antihomedir
ls -d "${XDG_DESKTOP_DIR:?}"/*[Tt][Oo][Dd][Oo]* >&2
esac
# has args OR if xtrace(set -x) is on, then dont execute shell specific 'rc' and fetch/color script:
# case $- in *c*|*x*)false;; *);; esac || # `$-` is bashism ...
case $#:${sh_isin_cmd+1}:$({ :; } 2>&1) in 0::) ;; *) return 0; esac
case :${BB-}: in *:nologin:*) return 0; esac
. "$B"/_fetch/_fetch"${sh_is_sh+".sh"}"
#ls ~/d >&2
unset-unseted-i