Articles Tagged "realpath"

View All Tags

Why a Bash Implementation of realpath?

Shortly after my recent post of a realpath implementation in bash my friend David Kendal suggested a C implementation would be preferable. I have to admit, it’s far simpler code, it wraps around the actual realpath() so no work to make it functionally equivalent, and it’ll be immensely faster (although I haven’t benchmarked it). See his example implementation. I really can’t agree more.

Keep Reading...

A realpath Implementation in Bash

I was recently informed of an issue with the in-development version of trash (one of the utilities in tools-osx) that required using an absolute path internally instead of a relative path. In most languages one can just run a path through realpath() to get the absolute path for a relative path, but bash (which trash was developed in) doesn’t have an equivalent. Many people suggest readlink, but it’s generally only included in Linux distributions, so BSD-based operating systems (incl. Mac OS X) are a bit out of luck.

Keep Reading...