W3cubDocs

/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

Input/output types:

input output
any any

Examples

Runs foo.nu in the current context

>sourcefoo.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

Notes

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

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