realpath 385 B

1234567891011121314
  1. #!/bin/sh
  2. ## This is a compatibility wrapper for 'realpath'. This script is not seen if
  3. ## the parent folder is after /usr/{local/}bin in PATH.
  4. if command -v greadlink >/dev/null 2>&1; then
  5. ## On BSD systems, we might have greadlink
  6. greadlink -f "$@"
  7. elif command -v readlink >/dev/null 2>&1 && [ "$(uname)" = "Linux" ]; then
  8. readlink -f "$@"
  9. else
  10. ## Dirty fallback
  11. echo "$@"
  12. fi