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:

inputoutput
anyany

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

Notes

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