Is there a way to include the ~ in the output of realpath
<p><code>realpath</code> is very nice in that it gives you a simple way to get the real path of a file, but I can't figure out a way to satisfy my needs (without doing my own string manipulation, and therefore potentially missing the corner cases that a dedicated utility presumably has found and solved).  In a nutshell, I want to include <code>~</code> in the path that it returns, so it can be valid across machines.  </p>

<p>So if I'm in <code>~/bin</code> and I type <code>realpath --some-option script.sh</code> I want it to return <code>~/bin/script.sh</code> instead of <code>bin/script.sh</code>, which is what I get if the option I use is <code>--relative-base=$HOME</code>, and instead of <code>/Users/brandon/bin/script.sh</code>, which is what I get if I use no options.</p>

<p>Is there some way to get what I want from <code>realpath</code>, or is there some other utility that does what I want in a simple way?  Or is the only real option to just pipe through <code>sed</code> to get what I want?</p>

<p>(P.S. I'm on OS X, but I've got GNU utilities installed, in case those are needed... I'm not sure if that's where <code>realpath</code> came from or if it's now installed by default on more recent versions of OS X.)</p>