![]() |
|
Think about Loose Coupling | |
PerlMonks |
Re^5: Getting the absolute path of a script, without PWD (bug?)(update)by perlancar (Hermit) |
on Jul 16, 2021 at 07:51 UTC ( #11135058=note: print w/replies, xml ) | Need Help?? |
after further investigation, it seems that `pwd` inside Perl doesn't default like pwd in bash ... which is unexpected The answer is perhaps this in perlop for the qx//: if the string contains no shell metacharacters then it will executed directly. So although in general qx// uses the shell, if we say `pwd` then perl will execute /bin/pwd, which defaults to -P. If we say `bash -c pwd` then bash will execute its shell builtin version of pwd, which defaults to -L.
In Section
Seekers of Perl Wisdom
|
|