mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 03:27:44 +00:00
show-utils.sh: modify script to be compatible with BSD OS
- Use /usr/bin/env bash instead of /bin/sh to define OSTYPE - Use GNU realpath on BSD OS (FreeBSD and OpenBSD) Signed-off-by: Laurent Cheylus <foxy@free.fr>
This commit is contained in:
parent
7aca1f932a
commit
d450d5a463
1 changed files with 14 additions and 4 deletions
|
@ -1,13 +1,23 @@
|
||||||
#!/bin/sh
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
# spell-checker:ignore (utils) cksum coreutils dircolors hashsum mkdir mktemp printenv printf readlink realpath rmdir shuf tsort unexpand
|
# spell-checker:ignore (shell) OSTYPE
|
||||||
|
# spell-checker:ignore (utils) cksum coreutils dircolors hashsum mkdir mktemp printenv printf readlink realpath grealpath rmdir shuf tsort unexpand
|
||||||
# spell-checker:ignore (jq) deps startswith
|
# spell-checker:ignore (jq) deps startswith
|
||||||
|
|
||||||
|
# Use GNU version for realpath on *BSD
|
||||||
|
case "$OSTYPE" in
|
||||||
|
*bsd*)
|
||||||
|
REALPATH="grealpath"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
REALPATH="realpath"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
ME="${0}"
|
ME="${0}"
|
||||||
ME_dir="$(dirname -- "${ME}")"
|
ME_dir="$(dirname -- "${ME}")"
|
||||||
ME_parent_dir="$(dirname -- "${ME_dir}")"
|
ME_parent_dir="$(dirname -- "${ME_dir}")"
|
||||||
# NOTE: On FreeBSD, `-mP` arguments are not available.
|
ME_parent_dir_abs="$("${REALPATH}" -mP -- "${ME_parent_dir}" || "${REALPATH}" -- "${ME_parent_dir}")"
|
||||||
ME_parent_dir_abs="$(realpath -mP -- "${ME_parent_dir}" || realpath -- "${ME_parent_dir}")"
|
|
||||||
|
|
||||||
# refs: <https://forge.rust-lang.org/release/platform-support.html> , <https://docs.rs/platforms/0.2.1/platforms/platform/tier1/index.html>
|
# refs: <https://forge.rust-lang.org/release/platform-support.html> , <https://docs.rs/platforms/0.2.1/platforms/platform/tier1/index.html>
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue