mirror of
https://github.com/kellymichels/zscripts-token-savers
synced 2026-10-07 07:18:18 +00:00
fix(bash): keep z_path fallback bash-3.2 clean (tr, not ${x,,})
The wslpath-absent fallback lowercased the drive letter with ${drive,,},
a bash-4.0 construct that breaks on macOS's stock bash 3.2. Use tr
instead so the whole helper stays 3.2-compatible.
This commit is contained in:
parent
48a5e7f7d6
commit
eedf549794
@ -47,10 +47,12 @@ z_path() {
|
||||
if command -v wslpath >/dev/null 2>&1; then
|
||||
wslpath -u "$p" 2>/dev/null || printf '%s' "$p"
|
||||
else
|
||||
# Fallback when wslpath is absent: F:\a\b -> /mnt/f/a/b
|
||||
local drive="${p%%:*}" rest="${p#*:}"
|
||||
rest="${rest//\\//}"
|
||||
printf '/mnt/%s%s' "${drive,,}" "$rest"
|
||||
# Fallback when wslpath is absent: F:\a\b -> /mnt/f/a/b. Lowercase the
|
||||
# drive via tr (not ${x,,}) so this stays bash-3.2 clean for macOS.
|
||||
local drive rest
|
||||
drive="$(printf '%s' "${p%%:*}" | tr '[:upper:]' '[:lower:]')"
|
||||
rest="${p#*:}"; rest="${rest//\\//}"
|
||||
printf '/mnt/%s%s' "$drive" "$rest"
|
||||
fi
|
||||
;;
|
||||
*) printf '%s' "$p" ;;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user