Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: :a modifier resolves symlinks - docs say it shouldn't



On Fri 29 May 2026, at 22:46, Mikael Magnusson wrote:
> I suppose you may expect it to prepend $PWD rather than the current
> directory for relative paths, but that is not the case.

what it prepends instead of the result of getcwd(3), about which posix
says:

> The getcwd() function shall place an absolute pathname of the current
> working directory in the array pointed to by buf, and return buf. The
> pathname shall contain no components that are dot or dot-dot, or are
> symbolic links.

imo it would be nice if it *did* prepend $PWD, that feels like the
expected thing. in the past i've just done that myself where it matters,
and it seems to work in the common case:

  [[ $dir == /* ]] || dir=$PWD/$dir
  dir=${dir:a}

but i think there are some other cases where $PWD itself is not what
you'd expect? not sure

dana




Messages sorted by: Reverse Date, Date, Thread, Author