mirror of
https://github.com/ahmetb/kubectx.git
synced 2025-06-06 14:12:45 +00:00
Fallback to readlink -f on macOS
BSD coreutils readlink doesn't have -f option, so adding a Python one-liner feedback to eval symlinks/homedir. Fixes #8. Signed-off-by: Ahmet Alp Balkan <ahmetb@google.com>
This commit is contained in:
parent
7e10232fdd
commit
8e413fc8ac
4
kubectx
4
kubectx
@ -21,7 +21,9 @@
|
|||||||
set -eou pipefail
|
set -eou pipefail
|
||||||
IFS=$'\n\t'
|
IFS=$'\n\t'
|
||||||
|
|
||||||
SCRIPT_DIR="$(dirname "$(readlink -f "$0")")"
|
SCRIPT_DIR="$(dirname "$( readlink -f "${0}" 2>/dev/null || \
|
||||||
|
python -c "import os,sys; print(os.path.realpath(sys.argv[1]))" "${0}" )")"
|
||||||
|
|
||||||
if [[ -f "${SCRIPT_DIR}/utils.bash" ]]; then
|
if [[ -f "${SCRIPT_DIR}/utils.bash" ]]; then
|
||||||
source "${SCRIPT_DIR}/utils.bash"
|
source "${SCRIPT_DIR}/utils.bash"
|
||||||
else
|
else
|
||||||
|
4
kubens
4
kubens
@ -21,7 +21,9 @@
|
|||||||
set -eou pipefail
|
set -eou pipefail
|
||||||
IFS=$'\n\t'
|
IFS=$'\n\t'
|
||||||
|
|
||||||
SCRIPT_DIR="$(dirname "$(readlink -f "$0")")"
|
SCRIPT_DIR="$(dirname "$( readlink -f "${0}" 2>/dev/null || \
|
||||||
|
python -c "import os,sys; print(os.path.realpath(sys.argv[1]))" "${0}" )")"
|
||||||
|
|
||||||
if [[ -f "${SCRIPT_DIR}/utils.bash" ]]; then
|
if [[ -f "${SCRIPT_DIR}/utils.bash" ]]; then
|
||||||
source "${SCRIPT_DIR}/utils.bash"
|
source "${SCRIPT_DIR}/utils.bash"
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user