run

For core.

Runs a script file in an isolated scope as part of a pipeline.

Command Type

keyword

Signature

> run {flags} (filename) ...rest

Flags

  • --full-reparse, -f: Reload and reparse the script on every invocation instead of using parser-cached blocks.

Parameters

  • filename: The filepath to the script file to run (null for no-op).
  • ...rest: Arguments to pass to the script’s def main if it exists.

Input/output types:

input output
any any

Examples

Run a simple transformation script in a pipeline.

> "hello" | run transform.nu

Run a script with arguments.

> "test" | run format.nu --prefix ">>>"

Run a script as part of a larger pipeline.

> ls | run process.nu | select name size

Always reload and reparse a script before each invocation.

> watch . -g *.nu | each -f { run --full-reparse ./test.nu }

Notes

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

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