File tree Expand file tree Collapse file tree 2 files changed +8
-3
lines changed
Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -1175,8 +1175,10 @@ subnet_hex() {
11751175}
11761176if fn_exists which; then
11771177 :
1178- else
1179- which () { [ " $( whereis $1 | awk -F: ' {print $2}' ) " != " " ]; }
1178+ elif fn_builtin_exists which; then
1179+ :
1180+ elif is_darwin; then
1181+ which () { whereis " $@ " ; }
11801182fi
11811183if is_darwin; then
11821184 readlinkx () {
@@ -1349,7 +1351,8 @@ main_do_sth() {
13491351BASH_SH_VERSION=v20250808
13501352DEBUG=${DEBUG:- 0}
13511353PROVISIONING=${PROVISIONING:- 0}
1352- SUDO=sudo && [ " $( id -u) " = " 0" ] && SUDO=
1354+ SUDO=sudo && [ " $( id -u) " = " 0" ] && SUDO= || :
1355+ LS_OPT=" --color" && is_darwin && LS_OPT=" -G" || :
13531356# Instantly aliases cannot work in many cases such as conditional
13541357# constructs, loops, even in statement block. So this won't work sometimes:
13551358# if [ true ]; then cmd-exist ls && echo 'ls exists' || echo 'ls not-exists'; fi
Original file line number Diff line number Diff line change @@ -16,6 +16,8 @@ wrn() { printf "\e[0;38;2;172;172;22m... [WARN] \e[0;38;2;11;11;11m$@\e[0m\n"; }
1616err () { printf " \e[0;33;1;133;133;133m>>> $@ \e[0m\n" 1>&2 ; }
1717fn_exists () { LC_ALL=C type $1 2> /dev/null | grep -qE ' (shell function)|(a function)' ; }
1818CD=" $( cd $( dirname " $0 " ) && pwd) " && BASH_SH_VERSION=v20250808 && DEBUG=${DEBUG:- 0} && PROVISIONING=${PROVISIONING:- 0}
19+ SUDO=sudo && [ " $( id -u) " = " 0" ] && SUDO=
20+ LS_OPT=" --color" && is_darwin && LS_OPT=" -G"
1921(( $# )) && {
2022 dbg " $# arg(s) | CD = $CD "
2123 check_entry () {
You can’t perform that action at this time.
0 commit comments