fish

Can a Fish script tell what directory it's stored in?


So, I really like Fish - but I need some help with scripting. and in particular finding the path of the script being run.

Here is the solution for BASH Getting the source directory of a Bash script from within

Can anyone help me find the equivalent with fish?


Solution

  • status --current-filename will output the path to the currently executing script.

    For more information on the status command, you can run man status or see the documentation at http://fishshell.com/docs/current/commands.html#status