Skip to content

Commit

Permalink
Merge pull request #9 from ahmetb/readlink
Browse files Browse the repository at this point in the history
Fallback to readlink -f on macOS
  • Loading branch information
ahmetb committed May 17, 2017
2 parents 7e10232 + 8e413fc commit 9a7358c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion kubectx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@
set -eou pipefail
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
source "${SCRIPT_DIR}/utils.bash"
else
Expand Down
4 changes: 3 additions & 1 deletion kubens
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@
set -eou pipefail
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
source "${SCRIPT_DIR}/utils.bash"
else
Expand Down

0 comments on commit 9a7358c

Please sign in to comment.