path self

For path.

Get the absolute path of the script or module containing this command at parse time.

Command Type

built-in

Signature

> path self {flags} (path)

Parameters

  • path: Path to get instead of the current file.

Input/output types:

input output
nothing string

Examples

Get the path of the current file.

> const current_file = path self

Get the path of the directory containing the current file.

> const current_file = path self .

Get the absolute form of a path relative to the current file.

> const current_file = path self ../foo

Ported from nushell/nushell.github.io. Copyright (c) 2021 Nushell Project. MIT License.