-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Make status dirname
work correctly in a script after $PWD
changes
#8562
Comments
I don't think so, it's specifically intended to provide you the path of the script you're running, not $PWD, I think? You can use $PWD or |
It is, yes. It's short for Only it's not absolutized, so if you start a script in the current directory it will effectively do There is a point to be made, there. Unfortunately it appears tricky to add this, because we don't currently store the script's directory anywhere, only the (relative) filename. So once you've cd'd, we've forgotten what it refers to to begin with. It's easy enough to work around: At the beginning of the script, run (also ask yourself whether you need the script's directory to begin with - in my experience many people do this reflexively but never actually need it) |
@floam, sorry, here is a more detailed example. I would expect that the script at the end here would print
|
What do you think about making the second
status dirname
call returntmp
, so that the mental model ofstatus dirname
is that at any point in a script, it returns the path to the folder containing that script?The text was updated successfully, but these errors were encountered: