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

dana <[email protected]>
Newsgroups gmane.comp.shells.zsh.devel
Message-ID <[email protected]>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.