New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
unexpected behavior between source and fish #2643
Comments
Both are technically correct and the documentation is ambiguous. It just says "prints the filename of the currently running script." without stating whether it will always result in an absolute path. Having said that I find the inconsistency surprising and would vote for updating the code and docs to state the path will always be absolute. |
It's weird that fish would fully resolve the path when passed a file. This was introduced in 06fd1aa a long time ago (the call to I'm unsure if it's better to show the relative path, absolute path, or fully resolved path (i.e. absolute with symlinks resolved). I think that resolving symlinks is bad, because some scripts are symlinked to each other and switch off their name to decide what to do. But as for absolute vs relative, I'm not sure - are there any legitimate uses for knowing the relative path? |
Yeah, upon further reflection I agree that defining it to always produce a relative path if one was used in the first place makes more sense than always converting to an absolute path since there is a trivial command for doing the latter. Obviously if the user explicitly specifies an absolute path then that is what they'll get from |
bc32604 makes the Thanks for reporting this! |
Ah, thanks for taking a look! The absolute path without the need of another utility like |
Stumbled across some unexpected behavior when using
source
vsfish
.The contents of
test.fish
:While using
fish
as mySHELL
and usingsource
to run the file themyvar
variable is set to a relative path to the file being run.➜ mydir source test.fish .
However, when using
fish
to run the file themyvar
variable is set to the absolute path to the file being run.➜ mydir fish test.fish /private/tmp/mydir
Is this expected? If so is there a workaround to keep the behavior consistent between the two of them? In this case we're expecting the absolute path to the file.
The text was updated successfully, but these errors were encountered: