Spec-Zone.ru › Nushell

source for core

Runs a script file in the current context.

Signature

> source {flags} (filename)

Parameters

  • filename: The filepath to the script file to source (null for no-op).

Input/output types:

input output
any any

Examples

Runs foo.nu in the current context.

> source foo.nu

Runs foo.nu in current context and call the command defined, suppose foo.nu has content: def say-hi [] { echo 'Hi!' }.

> source ./foo.nu; say-hi

Sourcing null is a no-op.

> source null

Source can be used with const variables.

> const file = if $nu.is-interactive { "interactive.nu" } else { null }; source $file

Notes

This command is a parser keyword. For details, check: https://www.nushell.sh/book/thinking_in_nu.html

Copyright © 2019–2026 The Nushell Project DevelopersLicensed under the MIT License.
https://www.nushell.sh/commands/docs/source.html

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API