Posted By

iloveitaly on 05/13/10


path Shell Bash mac conversion os x relative absolute realpath

Versions (?)

Relative to Absolute Path Conversion

 / Published in: Bash


the os x version of realpath works differently than the linux version; the following allows you to attain the same functionality in a shell on os x as readlink -f $0 on a standard linux dist.

  1. normalize_path() {
  2. eval "NORMALIZED_PATH=$1"
  3. NORMALIZED_PATH=`php -r "echo realpath('$NORMALIZED_PATH');"`
  4. }

Report this snippet  

You need to login to post a comment.