Skip to content

Commit f1cbe36

Browse files
committed
add LS_OPT definition
1 parent ab52899 commit f1cbe36

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

bash.sh

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1175,8 +1175,10 @@ subnet_hex() {
11751175
}
11761176
if 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 "$@"; }
11801182
fi
11811183
if is_darwin; then
11821184
readlinkx() {
@@ -1349,7 +1351,8 @@ main_do_sth() {
13491351
BASH_SH_VERSION=v20250808
13501352
DEBUG=${DEBUG:-0}
13511353
PROVISIONING=${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

simple-entry.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff 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"; }
1616
err() { printf "\e[0;33;1;133;133;133m>>> $@\e[0m\n" 1>&2; }
1717
fn_exists() { LC_ALL=C type $1 2>/dev/null | grep -qE '(shell function)|(a function)'; }
1818
CD="$(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() {

0 commit comments

Comments
 (0)