Nushell
Get Nu!
Getting Started
  • The Nushell Book
  • Command Reference
  • Cookbook
  • Language Reference Guide
  • Contributing Guide
Blog
  • English
  • 中文
  • Deutsch
  • Français
  • Español
  • 日本語
  • Português do Brasil
  • Русский язык
GitHub
Get Nu!
Getting Started
  • The Nushell Book
  • Command Reference
  • Cookbook
  • Language Reference Guide
  • Contributing Guide
Blog
  • English
  • 中文
  • Deutsch
  • Français
  • Español
  • 日本語
  • Português do Brasil
  • Русский язык
GitHub
  • Categories

    • Bits
    • Bytes
    • Chart
    • Conversions
    • Core
    • Database
    • Dataframe
    • Dataframe Or Lazyframe
    • Date
    • Debug
    • Default
    • Env
    • Experimental
    • Expression
    • Filesystem
    • Filters
    • Formats
    • Generators
    • Hash
    • History
    • Lazyframe
    • Math
    • Misc
    • Network
    • Path
    • Platform
    • Plugin
    • Prompt
    • Random
    • Removed
    • Shells
    • Strings
    • System
    • Viewers

tee for filters

Copy a stream to another command in parallel.

Signature

> tee {flags} (closure)

Flags

  • --stderr, -e: For external commands: copy the standard error stream instead.

Parameters

  • closure: The other command to send the stream to.

Input/output types:

inputoutput
anyany

Examples

Save a webpage to a file while also printing it

> http get http://example.org/ | tee { save example.html }

Save error messages from an external command to a file without redirecting them

> nu -c 'print -e error; print ok' | tee --stderr { save error.log } | complete

Print numbers and their sum

> 1..100 | tee { each { print } } | math sum | wrap sum

Do something with a value on another thread, while also passing through the value

> 10000 | tee { 1..$in | print } | $in * 5
50000

Notes

This is useful for doing something else with a stream while still continuing to use it in your pipeline.