[nycbug-talk] nifty(1)

Jan Schaumann jschauma at netmeister.org
Tue Aug 28 17:57:40 EDT 2012

"Isaac (.ike) Levy" <ike at blackskyresearch.net> wrote:
> # provides the concise full path to a shell script's parent dir
> (cd "${0%/*}" 2>/dev/null; echo "$PWD" /)
> # or my preference, without the trailing /
> (cd "${0%/*}" 2>/dev/null; echo "$PWD")

I've used

fullname() {
        local readonly arg="${1}"
        echo $(cd $(dirname ${arg}) && pwd -P)/$(basename ${arg})

for determining the arguments absolute full path.  This isn't builtins,
but it ensures you get the actual physical path (ie, all symlinks are

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 478 bytes
Desc: not available
URL: <http://lists.nycbug.org/pipermail/talk/attachments/20120828/65a6610b/attachment.bin>

More information about the talk mailing list