Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

3
  • The first solution seemed the most simple and obvious, but it only works once in a new shell. I suppose this is normal, fish probably just tries to define a function once then ignores the file. Isn't a function declaration missing in the then branch?
    – vctls
    Commented May 19, 2023 at 9:40
  • @vctls You are absolutely correct - My bad! Thanks for pointing that out. If you'd like to make the edit, I'll test it and accept. The function declaration needs to wrap the entire thing, I believe. Otherwise, it would just create the function if you were in that directory when the shell started. Commented May 19, 2023 at 10:49
  • That's right. I suppose the most logical behavior is to have it defined the same way whatever the initial pwd is.
    – vctls
    Commented May 19, 2023 at 10:53