in reply to Re: Getting the absolute path of a script, without PWD
in thread Getting the shell's version of working directory, without PWD's help

Thanks ikegami. Agreed. The working directory is a location chosen by the user. Due to symlinks one might reach the same location through different paths. And this state is in bash, there's no way of knowing this state unless bash exposes it.
  • Comment on Re^2: Getting the absolute path of a script, without PWD

Replies are listed 'Best First'.
Re^3: Getting the absolute path of a script, without PWD
by ikegami (Pope) on Jul 16, 2021 at 22:00 UTC

    It does. That's what $ENV{PWD} is. But to use that relies on the parent being process being bash, and it wouldn't be safe for a setuid script to use that.

    Seeking work! You can reach me at ikegami@adaelis.com